diff options
| -rw-r--r-- | src/CHANGELOG.md | 3 | ||||
| -rw-r--r-- | src/lsp/lsp.zig | 19 |
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(); |
