summaryrefslogtreecommitdiff
path: root/src/lsp/lsp.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/lsp/lsp.zig')
-rw-r--r--src/lsp/lsp.zig19
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();