Serve document symbols and highlights over LSP
SymbolIndex::find_by_path exposes one document's records with the same overlay shadowing and coverage as find. EditorDiagnostics maps them to textDocument/documentSymbol, and a bounded same-file highlight core (vls/features/DocumentSymbols.hpp) backs textDocument/documentHighlight from verified occurrence facts with the ambiguous-binding rule. Both are advertised and exercised over a real stdio session with the stock observer. Record the LSP parity matrix.
This commit is contained in:
1 parent
da8003f6d4
commit
8ca3dcbf74
16 files changed
+366
-8
No files matched your search
@@ -441,3 +441,20 @@ VOID_TEST(SymbolIndex, schema_2_rejects_edited_records) {
|
||||
expect(restored->status == SymbolIndex::LoadStatus::corrupt);
|
||||
expect(restored->quarantine.has_value());
|
||||
}
|
||||
|
||||
VOID_TEST(SymbolIndex, finds_records_by_path_with_overlay_shadowing) {
|
||||
SymbolIndex index;
|
||||
require(index.publish(
|
||||
context("debug:a", {record("a", "/project/a.cpp", 1), record("b", "/project/b.cpp", 2)})));
|
||||
require(index.publish(context("debug:b", {record("c", "/project/a.cpp", 9)})));
|
||||
auto result = index.find_by_path("/project/a.cpp");
|
||||
require(result.symbols.size() == 2);
|
||||
expect(result.symbols[0].name == "a" && result.symbols[1].name == "c");
|
||||
expect(result.coverage.indexed && !result.truncated);
|
||||
expect(index.find_by_path("/project/a.cpp", 1).truncated);
|
||||
require(index.set_overlay("/project/a.cpp", "content", {record("d", "/project/a.cpp", 4)}));
|
||||
result = index.find_by_path("/project/a.cpp");
|
||||
require(result.symbols.size() == 1);
|
||||
expect(result.symbols.front().name == "d");
|
||||
expect(index.find_by_path("/project/absent.cpp").symbols.empty());
|
||||
}
|
||||
Reference in new issue
Block a user