summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 11:09:00 -0300
committerGabriel Schneider <[email protected]>2026-11-05 11:09:00 -0300
commit2143d01eeeadd33c49ceaf22721729a5d03b2810 (patch)
tree6361423e592ed10ed1a69d8caaa3b45d0c6c1eb4 /src
parentfc02325789b5a6622f9e577c9a45e65806c516b6 (diff)
downloadpardes-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')
-rw-r--r--src/CHANGELOG.md3
-rw-r--r--src/lsp/lsp.zig19
2 files changed, 8 insertions, 14 deletions
diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md
index 7a3f41b3..e91bb289 100644
--- a/src/CHANGELOG.md
+++ b/src/CHANGELOG.md
@@ -126,7 +126,8 @@
and wrapped rows. Cross-directory call locations use shorter relative paths.
- Lspinfo's `+Lsp` starts with its language servers: the `backend:
lsp-client` line, left from when Zig files had an in-process backend of
- their own, is gone.
+ their own, is gone. A language word in a file no server speaks for names
+ the file (`Hover: no language server for notes.txt`).
- A terminal follows the shell at its prompt (the tty's foreground group),
not the process pardes started: a shell that re-execs itself under a
wrapper (fish's `exec 9ns --mntgen -- fish`) no longer leaves the pane
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();