summaryrefslogtreecommitdiff
path: root/src/lsp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lsp')
-rw-r--r--src/lsp/lsp.zig18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/lsp/lsp.zig b/src/lsp/lsp.zig
index eccd3ac6..e307a40d 100644
--- a/src/lsp/lsp.zig
+++ b/src/lsp/lsp.zig
@@ -89,24 +89,19 @@ test "an explain request narrates the query named in its arg, a definition by de
}
/// Every language, Zig's (zls) included, through the protocol client, which
-/// runs its server as a child process. None on the web.
-const has_client = switch (@import("pardes_config").platform) {
- .web => false,
- else => true,
-};
-const client = if (has_client) @import("lsp_client.zig") else void;
+/// runs its server as a child process.
+const client = @import("lsp_client.zig");
-pub const supports: std.EnumSet(Kind) = if (has_client) client.supports else .empty;
+pub const supports: std.EnumSet(Kind) = client.supports;
pub fn speaks(path: []const u8) bool {
- return has_client and client.speaks(path);
+ return 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 (has_client) return client.query(io, arena, req, out);
- try none(out, "no language server here", .{});
+ return client.query(io, arena, req, out);
}
/// The one line the client answers with when it cannot answer at all, and
@@ -117,7 +112,7 @@ pub fn none(out: *std.Io.Writer, comptime fmt: []const u8, args: anytype) std.Io
// Called on server reader threads; the sink must copy text before returning.
pub fn setStatusSink(ctx: ?*anyopaque, cb: ?*const fn (ctx: ?*anyopaque, text: []const u8) void) void {
- if (has_client) client.setStatusSink(ctx, cb);
+ client.setStatusSink(ctx, cb);
}
pub fn rel(base: []const u8, path: []const u8) []const u8 {
@@ -199,7 +194,6 @@ test "LSP encoders report every insufficient output capacity" {
}
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();
var buf: [256]u8 = undefined;