summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 14:06:59 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commitf8c325283fe87dd981babd2a132e58eb393924a1 (patch)
tree7f32b19a7fda82dcf41ef285e8912863f9fb97c8 /src
parente2b18ea6897057bd481f7c59d1617677dc2928e9 (diff)
downloadpardes-f8c325283fe87dd981babd2a132e58eb393924a1.tar.gz
pardes-f8c325283fe87dd981babd2a132e58eb393924a1.zip
A language with no server to start says language server for .py not found, not that it did not answer
A question about a file whose language server is not there came back as no answer at all, which the core said as the language server did not answer. The client now answers @none language server for <ext> not found, ENOENT by its words. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/lsp/lsp_client.zig15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lsp/lsp_client.zig b/src/lsp/lsp_client.zig
index 91ea67d6..7c1980f6 100644
--- a/src/lsp/lsp_client.zig
+++ b/src/lsp/lsp_client.zig
@@ -429,6 +429,8 @@ pub fn query(gpa: std.mem.Allocator, arena: std.mem.Allocator, req: lsp.Req, out
record(si, req, us, rows, err_name);
if (req.kind == .explain) return traceOut(&tr, req, out, rows, us);
+ // No server to start for the language: said, not "did not answer".
+ if (failure) |err| if (err == error.NoServer) return lsp.none(out, "language server for {s} not found", .{std.fs.path.extension(req.path)});
if (failure) |err| return err;
try out.writeAll(scratch.buffered());
}
@@ -2231,3 +2233,16 @@ test "LSP source snippets preserve indentation with UTF16 byte ranges and prose
}
}
}
+
+test "a language with no server to start says so, not that it did not answer" {
+ const si = specFor("/x/a.py") orelse return;
+ const was = conns[si].state;
+ conns[si].state = .disabled;
+ defer conns[si].state = was;
+ var arena: std.heap.ArenaAllocator = .init(std.testing.allocator);
+ defer arena.deinit();
+ var buf: [256]u8 = undefined;
+ var out: std.Io.Writer = .fixed(&buf);
+ try query(std.testing.allocator, arena.allocator(), .{ .kind = .hover, .path = "/x/a.py", .source = "", .offset = 0 }, &out);
+ try std.testing.expectEqualStrings("@none language server for .py not found\n", out.buffered());
+}