1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! Salsa inputs.
use Arc;
use PhpVersion;
use crateFileIndex;
/// Immortal per-file text input. One per unique URI ever seen.
/// Holds the raw source text and the optional K2 on-disk cache seed.
///
/// `cached_index` (Phase K2): when `Some`, holds a pre-computed `FileIndex`
/// loaded from the on-disk cache. `file_index` checks this field first and
/// returns the cached index instead of parsing + extracting. Cleared back to
/// `None` on any text edit — see `DocumentStore::mirror_text` — so a stale
/// cached index cannot mask a real change. Seeded by workspace scan via
/// `DocumentStore::seed_cached_index` before the first `file_index` call for
/// that file.
/// Tracked struct representing one active workspace file.
/// Produced by `workspace_files`; salsa GC's it (and all downstream memos)
/// when the file is removed from the workspace.
/// Identity fields: uri + text_input (both stable per unique URI).
/// Workspace-level input: the set of active (non-deleted) files.
/// Each entry is (uri_arc, FileText_handle) — sorted by uri for stable ordering.
/// Only changed when files are added or removed, not on text edits.
///
/// Uses `durability = HIGH` conceptually — the file list changes rarely
/// (workspace scan, deletions), not on every edit. Salsa's default durability
/// is LOW; backend can opt into HIGH via `set_files` if churn becomes an issue.
/// Produce SourceFile tracked structs for all active workspace files.
/// Salsa GC removes SourceFile entities (and cascades to parsed_doc, file_index,
/// symbol_map, parse_error_count) when they are absent from this function's output.
/// O(log N) lookup of a single `SourceFile` by URI string.
///
/// `Workspace::files` is kept sorted by URI (see `DocumentStore::sync_workspace_files`),
/// so binary search gives the index in O(log N). `workspace_files` outputs in the
/// same 1:1 order, so the same index addresses both slices.