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:
agra
2026-05-31 13:36:20 +03:00
parent 8b4006a68d
commit 292fd937c6
4 changed files with 221 additions and 29 deletions

View File

@@ -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;
}