diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 11:09:00 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 11:09:00 -0300 |
| commit | 2143d01eeeadd33c49ceaf22721729a5d03b2810 (patch) | |
| tree | 6361423e592ed10ed1a69d8caaa3b45d0c6c1eb4 /src/lsp | |
| parent | fc02325789b5a6622f9e577c9a45e65806c516b6 (diff) | |
| download | pardes-2143d01eeeadd33c49ceaf22721729a5d03b2810.tar.gz pardes-2143d01eeeadd33c49ceaf22721729a5d03b2810.zip | |
lsp: the seam asks the one client every question, the check left from two backends (a kind the backend answers) going with its fallback: a file no server speaks for is answered by the client, `no language server for notes.txt` where it was `no language server for this file`, and the changelog says so
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/lsp')
| -rw-r--r-- | src/lsp/lsp.zig | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/src/lsp/lsp.zig b/src/lsp/lsp.zig index 190c05f8..038e4230 100644 --- a/src/lsp/lsp.zig +++ b/src/lsp/lsp.zig @@ -97,21 +97,14 @@ pub fn speaks(path: []const u8) bool { return has_client and client.speaks(path); } +/// Every question, a file no server speaks for included: the client says +/// why it asked nothing, where an empty answer would read as nothing found. pub fn query(io: std.Io, arena: std.mem.Allocator, req: Req, out: *std.Io.Writer) !void { - if (req.kind == .status) { - if (has_client) try client.query(io, arena, req, out); - return; - } - if (has_client and (req.kind == .explain or (client.speaks(req.path) and client.supports.contains(req.kind)))) - return client.query(io, arena, req, out); - // Nothing asked: said why, where an empty answer would read as nothing - // found. - if (speaks(req.path)) - return none(out, "the language server for this file does not answer it", .{}); - try none(out, "no language server for this file", .{}); + if (has_client) return client.query(io, arena, req, out); + try none(out, "no language server here", .{}); } -/// The one line a backend answers with when it cannot answer at all, and +/// The one line the client answers with when it cannot answer at all, and /// why: the core says it rather than "nothing found". pub fn none(out: *std.Io.Writer, comptime fmt: []const u8, args: anytype) std.Io.Writer.Error!void { try out.print("@none " ++ fmt ++ "\n", args); @@ -200,7 +193,7 @@ test "LSP encoders report every insufficient output capacity" { } } -test "a question no backend answers for a file says why rather than find nothing" { +test "a question for a file no language server speaks for says why rather than find nothing" { if (!has_client) return; var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); |
