summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 22:31:27 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:17 -0300
commit7e8e2655567cab1c28597f44d0aec79e46b0deb8 (patch)
tree1dd74701cfcbd6b663170e86df854166ed0f0600 /build.zig
parent813a0b2bf3c110f2287d7136f0dfc540c0978cd6 (diff)
downloadpardes-7e8e2655567cab1c28597f44d0aec79e46b0deb8.tar.gz
pardes-7e8e2655567cab1c28597f44d0aec79e46b0deb8.zip
Zig files go to zls as a child process through the protocol client, as every other language does: the in-process ZLS backend goes
lsp_zls.zig (1,522 lines), the zls dependency, build.zig's zls wiring and the import graph it baked into the options only for it, and main.zig's reference go. lsp_client's table gains a zls row (PARDES_LSP_ZIG overrides it); Hover, Rename, Diagnostics, WsSymbols, Lspinfo and gd answer through it (checked with lspprobe and the snapshots against zls 0.16.1-dev). What changes for a user: zls must be on PATH; a completion's rows are zls's candidates at the cursor, where the linked analyser gave each one's declaration; document symbols carry no signature. The Zig snapshots (lsp, lspcomplete, lspcompletemoved, lspdebug, lsprelpath) run the real zls now: lspdebug reads the client's explain and report, lsprelpath spells gr's rows where it spelled a completion's, and their goldens are recorded again (stable over three runs). Lspinfo still opens with its backend line. The ReleaseFast tty binary is 105.35 MB to 96.28 MB, the Debug one 296.5 MB to 245.9 MB. docs/lsp.md, web.md, design.typ and the README say so. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig72
1 files changed, 0 insertions, 72 deletions
diff --git a/build.zig b/build.zig
index e74bf303..fcb4b0b7 100644
--- a/build.zig
+++ b/build.zig
@@ -30,19 +30,6 @@ const PerfBuild = struct {
pub const macos_min_version: std.SemanticVersion = .{ .major = 13, .minor = 0, .patch = 0 };
-const zls_version = "0.16.1-dev+3e0d0820";
-
-comptime {
- const plus = std.mem.indexOfScalar(u8, zls_version, '+') orelse
- @compileError("zls_version must end in +<short commit>");
- const short = zls_version[plus + 1 ..];
- const url = zon.dependencies.zls.url;
- const hash = std.mem.indexOfScalar(u8, url, '#') orelse
- @compileError("the zls dependency url must pin a commit with #<sha>");
- if (!std.mem.startsWith(u8, url[hash + 1 ..], short)) @compileError(
- "zls_version pins commit " ++ short ++ ", build.zig.zon pins " ++ url[hash + 1 ..],
- );
-}
pub const TreeSitterGrammars = enum { disabled, zig, minimal, full };
const gui_shaders = [_][]const u8{
@@ -280,7 +267,6 @@ pub fn build(b: *std.Build) void {
// The conditional dependencies, hoisted so one `wireCore` call at the end
// can name them all. The unconditional ones are ordinary consts below.
- var zls_mod: ?*std.Build.Module = null;
var ts_mod: ?*std.Build.Module = null;
var ts_queries_opts: ?*std.Build.Step.Options = null;
var mupdf_core_mod: ?*std.Build.Module = null;
@@ -308,8 +294,6 @@ pub fn build(b: *std.Build) void {
if (target.result.os.tag == .freebsd or target.result.os.tag == .netbsd or target.result.os.tag == .openbsd)
root_mod.linkSystemLibrary("util", .{});
- const zls_backend = !freestanding_core;
-
const esp32p4_cols = b.option(u16, "esp32p4-cols", "the board's grid width in cells (-Dplatform=esp32p4 only)") orelse 56;
const esp32p4_rows = b.option(u16, "esp32p4-rows", "the board's grid height in cells (-Dplatform=esp32p4 only)") orelse 14;
const theme_animation = b.option(bool, "theme-animation", "animate chrome colors across a theme change (default: off for esp32p4)");
@@ -329,7 +313,6 @@ pub fn build(b: *std.Build) void {
const shell_cfg: ShellConfig = .{
.tree_sitter_grammars = tree_sitter_grammars,
.tracy = tracy != null,
- .zls_backend = zls_backend,
.mupdf = enable_mupdf,
.esp32p4_cols = esp32p4_cols,
.esp32p4_rows = esp32p4_rows,
@@ -337,21 +320,11 @@ pub fn build(b: *std.Build) void {
.workspace_tag = workspace_tag,
.prebuilt_shaders = prebuilt_shaders,
.embed_sources = embed_sources,
- .zig_lib_dir = b.graph.zig_lib_directory.path orelse "",
.commit = if (stamp_commit) gitCommit(b) else null,
};
const opts = shellOptions(b, shell_cfg, platform);
const gui_opts: ?*std.Build.Step.Options = if (also_gui) shellOptions(b, shell_cfg, .gui) else null;
- if (zls_backend) {
- const zls_dep = b.dependency("zls", .{
- .target = target,
- .optimize = optimize,
- .@"version-string" = @as([]const u8, zls_version),
- });
- zls_mod = zls_dep.module("zls");
- }
-
if (tracy) |tracy_path| {
for ([_]*std.Build.Module{ root_mod, core_module }) |mod| {
mod.addIncludePath(.{ .cwd_relative = tracy_path });
@@ -939,7 +912,6 @@ pub fn build(b: *std.Build) void {
// BEFORE the fold below, which reads what these imports put in the table.
for (core_mods) |m| wireCore(m, .{
.themes = themes_mod,
- .zls = zls_mod,
.tree_sitter = ts_mod,
.ts_libs = ts_libs.items,
.ts_queries = ts_queries_opts,
@@ -952,43 +924,6 @@ pub fn build(b: *std.Build) void {
.uucode = uucode_mod,
});
- var module_count: usize = 0;
- {
- var it = root_mod.import_table.iterator();
- while (it.next()) |e| {
- const lp = e.value_ptr.*.root_source_file orelse continue;
- switch (lp) {
- .src_path, .cwd_relative => module_count += 1,
- else => continue,
- }
- }
- }
- const mod_names = b.allocator.alloc([]const u8, module_count) catch @panic("OOM");
- const mod_roots = b.allocator.alloc([]const u8, module_count) catch @panic("OOM");
- var module_index: usize = 0;
- {
- var it = root_mod.import_table.iterator();
- while (it.next()) |e| {
- const lp = e.value_ptr.*.root_source_file orelse continue;
- // `generated` is a build artifact (the options modules): it has no
- // path until make() runs, and pointing an editor at one is useless
- const abs = switch (lp) {
- .src_path => |sp| sp.owner.pathFromRoot(sp.sub_path),
- .cwd_relative => |cr| cr,
- else => continue,
- };
- mod_names[module_index] = e.key_ptr.*;
- mod_roots[module_index] = abs;
- module_index += 1;
- }
- }
- std.debug.assert(module_index == module_count);
- for ([_]?*std.Build.Step.Options{ opts, gui_opts }) |maybe| if (maybe) |o| {
- o.addOption([]const []const u8, "module_names", mod_names);
- o.addOption([]const []const u8, "module_roots", mod_roots);
- // Whose imports those are: a .zig file outside this tree has none of them.
- o.addOption([]const u8, "project_root", b.build_root.path orelse "");
- };
const iso_off = b.addOptions();
iso_off.addOption(bool, "isolated", false);
@@ -1911,7 +1846,6 @@ fn gitCommit(b: *std.Build) ?[]const u8 {
const ShellConfig = struct {
tree_sitter_grammars: TreeSitterGrammars,
tracy: bool,
- zls_backend: bool,
mupdf: bool,
esp32p4_cols: u16,
esp32p4_rows: u16,
@@ -1923,7 +1857,6 @@ const ShellConfig = struct {
workspace_tag: ?bool,
prebuilt_shaders: bool,
embed_sources: bool,
- zig_lib_dir: []const u8,
commit: ?[]const u8,
};
@@ -1935,19 +1868,16 @@ fn shellOptions(b: *std.Build, cfg: ShellConfig, platform: Platform) *std.Build.
o.addOption(bool, "syntax_minimal_grammars", cfg.tree_sitter_grammars == .minimal or cfg.tree_sitter_grammars == .full);
o.addOption(bool, "syntax_full_grammars", cfg.tree_sitter_grammars == .full);
o.addOption(bool, "enable_tracy", cfg.tracy);
- o.addOption(bool, "zls_backend", cfg.zls_backend);
o.addOption(bool, "mupdf", cfg.mupdf);
o.addOption(u16, "esp32p4_cols", cfg.esp32p4_cols);
o.addOption(u16, "esp32p4_rows", cfg.esp32p4_rows);
o.addOption(bool, "workspace_tag", cfg.workspace_tag orelse (platform != .macos));
o.addOption(bool, "theme_animation", cfg.theme_animation orelse (platform != .esp32p4));
- o.addOption([]const u8, "zls_version", if (cfg.zls_backend) zls_version else "none");
o.addOption(bool, "embed_sources", cfg.embed_sources);
o.addOption([]const u8, "version", zon.version);
// ...and the commit it was built from, when there is one and the build
// is stamped at all (see `stamp_commit`). Read at configure time.
o.addOption(?[]const u8, "commit", cfg.commit);
- o.addOption([]const u8, "zig_lib_dir", cfg.zig_lib_dir);
return o;
}
@@ -2032,7 +1962,6 @@ fn vendoredThemes(b: *std.Build, io: std.Io) []const []const u8 {
fn wireCore(m: *std.Build.Module, d: struct {
themes: ?*std.Build.Module = null,
- zls: ?*std.Build.Module = null,
tree_sitter: ?*std.Build.Module = null,
ts_libs: []const *std.Build.Step.Compile = &.{},
ts_queries: ?*std.Build.Step.Options = null,
@@ -2045,7 +1974,6 @@ fn wireCore(m: *std.Build.Module, d: struct {
uucode: ?*std.Build.Module = null,
}) void {
if (d.themes) |x| m.addImport("generated_themes", x);
- if (d.zls) |x| m.addImport("zls", x);
if (d.tree_sitter) |x| m.addImport("tree-sitter", x);
for (d.ts_libs) |lib| m.linkLibrary(lib);
if (d.ts_queries) |x| m.addOptions("ts_queries", x);