summaryrefslogtreecommitdiff
path: root/src/lsp.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/lsp.zig')
-rw-r--r--src/lsp.zig20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/lsp.zig b/src/lsp.zig
index 62b5e1bb..fe492c62 100644
--- a/src/lsp.zig
+++ b/src/lsp.zig
@@ -123,19 +123,23 @@ pub fn lineCol(source: []const u8, offset: usize) struct { line: usize, col: usi
/// appends nothing, and the core treats "no rows" as "no result", which is
/// also what a language server that is still starting up looks like.
pub fn query(gpa: std.mem.Allocator, arena: std.mem.Allocator, req: Req, out: *std.ArrayList(u8)) void {
- // ponytail: the base tree has no backend on purpose — this is the seam the
- // competing implementations fill in, and an empty answer is a legal one.
- _ = gpa;
- _ = arena;
- _ = req;
- _ = out;
+ backend.query(gpa, arena, req, out);
}
+/// ZLS, linked in as a module and called directly — no subprocess, no
+/// JSON-RPC. See `lsp_zls.zig`. The web shell has no threads, never emits the
+/// effect, and cannot build ZLS anyway, so there it is the empty backend the
+/// base tree shipped with.
+const backend = if (@import("pardes_config").zls_backend) @import("lsp_zls.zig") else struct {
+ pub fn query(_: std.mem.Allocator, _: std.mem.Allocator, _: Req, _: *std.ArrayList(u8)) void {}
+ pub const supports: std.EnumSet(Kind) = .initEmpty();
+};
+
/// What this backend can actually answer, for the evaluation harness and for
/// the core (a Kind that is not supported never leaves the keymap). An
/// implementation narrows this to what it really does — claiming a feature it
/// does not have shows up immediately in the harness's matrix.
-pub const supports: std.EnumSet(Kind) = .initEmpty();
+pub const supports: std.EnumSet(Kind) = backend.supports;
/// Name shown by the harness and in `SPC ?`. Each implementation renames it.
-pub const backend_name = "none";
+pub const backend_name = "zls-inproc";