lsp: whole-program diagnostics from the real compiler on save
Reuse the compiler's lowering pass instead of re-implementing its checks in sema. A module can't be lowered standalone — lowering only type-checks functions reachable from a root — so the open file alone misses errors like a *Move passed into a by-value method parameter. Drive the workspace entry (main.sx) through parse → resolveImports → lowerToIR, then attribute each diagnostic back to its file via source_file and publish per file (clearing files whose errors are gone). Runs on didOpen/didSave (disk-based); sema stays the live per-keystroke layer. Advertise textDocumentSync.save so the editor sends didSave. collectProjectDiagnostics is split out (transport-free) and covered by a hermetic temp-project test.
This commit is contained in:
@@ -102,7 +102,7 @@ fn writeJsonValue(buf: *std.ArrayList(u8), allocator: std.mem.Allocator, value:
|
||||
/// Build the initialize result JSON.
|
||||
pub fn initializeResultJson(allocator: std.mem.Allocator) ![]const u8 {
|
||||
return std.fmt.allocPrint(allocator,
|
||||
"{{\"capabilities\":{{\"textDocumentSync\":1,\"definitionProvider\":true,\"referencesProvider\":true,\"hoverProvider\":true,\"documentSymbolProvider\":true," ++
|
||||
"{{\"capabilities\":{{\"textDocumentSync\":{{\"openClose\":true,\"change\":1,\"save\":true}},\"definitionProvider\":true,\"referencesProvider\":true,\"hoverProvider\":true,\"documentSymbolProvider\":true," ++
|
||||
"\"completionProvider\":{{\"triggerCharacters\":[\".\"]}}," ++
|
||||
"\"signatureHelpProvider\":{{\"triggerCharacters\":[\"(\",\",\"]}}," ++
|
||||
"\"semanticTokensProvider\":{{\"legend\":{{" ++
|
||||
|
||||
Reference in New Issue
Block a user