diff options
Diffstat (limited to 'src/lsp/lsp_client.zig')
| -rw-r--r-- | src/lsp/lsp_client.zig | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/lsp/lsp_client.zig b/src/lsp/lsp_client.zig index 7c1980f6..7704d0ad 100644 --- a/src/lsp/lsp_client.zig +++ b/src/lsp/lsp_client.zig @@ -1,9 +1,8 @@ //! A real Language Server Protocol client: child processes spoken to over //! JSON-RPC 2.0 with `Content-Length` framing. Nothing here knows any single //! language — `specs` is a table of (binary, languageId, extensions, root -//! markers), and rust-analyzer, clangd and gopls are rows in it. The in-process -//! ZLS backend keeps `.zig`; this file is every language pardes highlights but -//! could not answer questions about. +//! markers), and zls, rust-analyzer, clangd and gopls are rows in it: every +//! language pardes answers questions about. //! //! THE PROCESS LIFECYCLE IS THE DESIGN. `lsp.query` is a synchronous call on a //! worker thread, and a language server costs tens of milliseconds to start @@ -104,6 +103,14 @@ const Spec = struct { pub const specs = [_]Spec{ .{ + .name = "zls", + .bin = "zls", + .lang = "zig", + .exts = &.{".zig"}, + .markers = &.{ "build.zig", "build.zig.zon" }, + .env = "PARDES_LSP_ZIG", + }, + .{ .name = "rust-analyzer", .bin = "rust-analyzer", .lang = "rust", @@ -147,8 +154,7 @@ pub const specs = [_]Spec{ }, }; -/// Everything, including the four hierarchy kinds the in-process backend has -/// no analyser for. Whether one SERVER can answer is a capability question +/// Everything. Whether one SERVER can answer is a capability question /// answered per connection; a kind its server never advertised simply returns /// no rows, which the harness reports as CLAIMED-EMPTY per language — honest, /// since the claim here is about the protocol, not about every server. @@ -2175,9 +2181,9 @@ test "rootOf takes the top-most marker and falls back to git then dir" { test "specFor routes extensions and honours the disable env" { try std.testing.expect(specFor("/x/main.rs") != null); - try std.testing.expect(specFor("/x/main.zig") == null); try std.testing.expect(specFor("/x/README.md") == null); try std.testing.expectEqualStrings("rust-analyzer", specs[specFor("/x/main.rs").?].name); + if (getenv("PARDES_LSP_ZIG") == null) try std.testing.expectEqualStrings("zls", specs[specFor("/x/main.zig").?].name); } test "the transport this host actually gives us is a pair, and both ends are close-on-exec" { |
