M2.5: symbol index and go-to commands

crates/index: walks the project with the search/VFS rules (vendor as
library), parses .php files from tree-sitter outlines on a worker pool
off the engine lock, updates incrementally from disk and buffers through
an updater thread, caps at 200,000 files, and answers fuzzy file, class
and symbol queries (nucleo-matcher, MPL-2.0 as a separate crate).

Engine: index.status, goto.file, goto.class, goto.symbol; events
indexProgress and indexReady drained by the pump; the index starts on
project.open and is cancelled on close. Tests: unit, incremental,
property (random queries and sources), engine and TCP control tests,
release timing on a generated 20k-file project (3.9-4.2 s).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-10-17 12:53:33 +02:00
parent f13a49064d
commit 053441d066
26 changed files with 3455 additions and 9 deletions

View file

@ -169,6 +169,24 @@ pub enum Event {
/// Wall time of the search in milliseconds.
elapsed_ms: u64,
},
/// The symbol index is being built after `project.open`; sent at most
/// every 250 ms while it runs.
IndexProgress {
/// Files indexed so far.
done: usize,
/// Files found in the project.
total: usize,
},
/// The initial build of the symbol index ended (or was cut short); go-to
/// queries now see the whole project.
IndexReady {
/// Files in the index.
files: usize,
/// Symbols in the index.
symbols: usize,
/// Wall time of the build in milliseconds.
elapsed_ms: u64,
},
}
/// One match of [`Event::SearchResults`]. Positions are 0-based; columns
@ -312,6 +330,27 @@ mod tests {
);
}
#[test]
fn index_shapes() {
let e = Event::IndexProgress {
done: 10,
total: 20,
};
assert_eq!(
serde_json::to_value(e).unwrap(),
json!({"kind": "indexProgress", "done": 10, "total": 20})
);
let e = Event::IndexReady {
files: 20,
symbols: 300,
elapsed_ms: 1500,
};
assert_eq!(
serde_json::to_value(e).unwrap(),
json!({"kind": "indexReady", "files": 20, "symbols": 300, "elapsedMs": 1500})
);
}
#[test]
fn recovery_resolved_shape() {
let e = Event::RecoveryResolved {