summaryrefslogtreecommitdiff
path: root/src/lsp
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 11:40:11 -0300
committerGabriel Schneider <[email protected]>2026-11-05 12:41:36 -0300
commit3f1533813b6692a736251e4d467a7f108229ddee (patch)
tree37a32c5ebbf9d3af08923856fd6fa516f3b33a39 /src/lsp
parentcfd2b993feda1b3f7474225bb32db8cac8edc5ae (diff)
downloadpardes-3f1533813b6692a736251e4d467a7f108229ddee.tar.gz
pardes-3f1533813b6692a736251e4d467a7f108229ddee.zip
targets: the DOM web shell goes (src/web.zig and src/web/, its harnesses web_harness, web_snapshot, web_driver_test and web-snapshots/, tools/web_fixture.py, -Dplatform=web, -Ddump, and the web, web-harness, web-snap, web-e2e and web-driver-test steps), and with it what only a freestanding build needed: `hosted` and every guard on it (every build has a host now), memory's stack-fallback arenas and reduced_target sizes, the emscripten main, the tree-sitter libc shim and the stb stub, lsp's has_client, the web arms of the platform switches (-Dplatform is tui, gui or macos); the macOS files pass zig ast-check; docs/web.md is a paragraph on what it was
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
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;