lsp: project-wide find-references + revive the LSP test suite
find-references only searched documents the editor had open, so asking for references to a field from a file whose users were all closed returned just the definition. Load every .sx under the workspace root before matching so uses in unopened files are found too. The LSP server's own tests were dormant: nested under the `lsp` struct in root.zig, refAllDecls never reached them, and they had bit-rotted (stale DocumentStore.init arity, an unaligned dummy io, fake /test/ paths that no longer resolve). Reference the lsp files directly so their tests run, give the doc-store tests a real Threaded io with bare paths, and fix the stale extractIdentAtOffset expectation. Extract referencesPayload from the transport so it is unit-testable, and add tests covering cross-document field references, includeDeclaration, the for-loop capture inlay hint, and workspace file loading.
This commit is contained in:
@@ -28,4 +28,10 @@ test {
|
||||
// (e.g. ir/ir.zig) carry their own `test { refAllDecls }`, so this chains
|
||||
// into them.
|
||||
@import("std").testing.refAllDecls(@This());
|
||||
// refAllDecls only reaches the top-level decls; the `lsp` files live one
|
||||
// struct deeper, so reference them directly to pull in their tests.
|
||||
_ = lsp.server;
|
||||
_ = lsp.document;
|
||||
_ = lsp.types;
|
||||
_ = lsp.transport;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user