diff options
Diffstat (limited to 'core')
| -rw-r--r-- | core/CHANGELOG.md | 14 | ||||
| -rw-r--r-- | core/Core.zig | 2 | ||||
| -rw-r--r-- | core/Dir.zig | 2 | ||||
| -rw-r--r-- | core/File.zig | 1 | ||||
| -rw-r--r-- | core/Output.zig | 2 | ||||
| -rw-r--r-- | core/Plumb.zig | 2 | ||||
| -rw-r--r-- | core/Query.zig | 7 | ||||
| -rw-r--r-- | core/Stream.zig | 16 | ||||
| -rw-r--r-- | core/builtins.zig | 2 | ||||
| -rw-r--r-- | core/config.zig | 2 | ||||
| -rw-r--r-- | core/draw.zig | 1 | ||||
| -rw-r--r-- | core/dump.zig | 7 | ||||
| -rw-r--r-- | core/edit_cmd.zig | 4 | ||||
| -rw-r--r-- | core/fs.zig | 15 | ||||
| -rw-r--r-- | core/grammar_manifest.zig | 4 | ||||
| -rw-r--r-- | core/lib_syntax.zig | 4 | ||||
| -rw-r--r-- | core/look.zig | 16 | ||||
| -rw-r--r-- | core/mouse.zig | 1 | ||||
| -rw-r--r-- | core/replica.zig | 2 | ||||
| -rw-r--r-- | core/root.zig | 2 | ||||
| -rw-r--r-- | core/syntax.zig | 113 |
21 files changed, 59 insertions, 160 deletions
diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index fe9adec8..67fbdf69 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -232,9 +232,9 @@ grammars, highlighting, declarations, syntax tree and themes as the editor has them, for a program that draws source text itself. Every dependency but tree-sitter's runtime is lazy in the manifest, so such a - package fetches the runtime and the grammars of its `tree-sitter` set + package fetches the runtime and the grammars of its `grammars` set and nothing else; `zig build lib-test`, which `unit-test` runs, builds - one (`test/lib`). The markdown grammar is pinned by its commit: its + one (`test/consumer`). The markdown grammar is pinned by its commit: its branch has moved, and a fresh checkout could not fetch it. - Enter, `o` and `O` give the new line helix's indent where the file's @@ -590,6 +590,16 @@ - A scroll in the window never moves the tree-sitter context rows: the body glides under them. +- `zig build run-isolated` and its `pardes-isolate` are gone: the + terminal's pardes with no host but the terminal and no filesystem had + not compiled for some releases, and nothing ran it. So is + `-Dtree-sitter=disabled`, a pardes with no tree-sitter, which did not + compile either; every build has tree-sitter's runtime. The grammar set + is `-Dgrammars` (`.grammars` for a package that depends on pardes, no + longer `.@"tree-sitter"`): `none`, the runtime alone, where a program + hands in a grammar of its own at run time, `minimal` or `full`; the + `zig` set, which `none` replaces, is gone. + ## 0.24 - Edit runs all of acme's commands: `< | >` through your Shell (one undo diff --git a/core/Core.zig b/core/Core.zig index e2f8cd8a..a18e891c 100644 --- a/core/Core.zig +++ b/core/Core.zig @@ -2504,7 +2504,6 @@ test "LocationsConfig command reports partial updates and survives restore" { } test "TreeContext rows in the tag style keep the message rows" { - if (comptime !syntax.enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 16 }); defer p.deinit(); const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (std.mem.asBytes(&@as([30][16]u8, @splat(" // body\n".*)))) ++ " }\n};\n"); @@ -2547,7 +2546,6 @@ test "TreeContext rows in the tag style keep the message rows" { } test "TreeContext command and custom tag survive a workspace round trip" { - if (comptime !syntax.enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true }); defer p.deinit(); const pane = try p.setTestFile("pub fn main() void {}\n"); diff --git a/core/Dir.zig b/core/Dir.zig index 29c5cdc8..869a7cd5 100644 --- a/core/Dir.zig +++ b/core/Dir.zig @@ -47,7 +47,6 @@ pub fn ofName(name: []const u8) []const u8 { /// dotfiles too; a directory's, a link to one's too, ending in `/`; sorted /// bytewise, the `/` counted; each ending in a newline. pub fn read(tape: *pardes.tape.Tape, gpa: std.mem.Allocator, dir: []const u8) ![]u8 { - if (comptime !filesystem.platform_has_fs) return error.FileNotFound; const local = filesystem.localPath(dir) orelse return error.NotLocal; // Its own copy: the caller's may be a pane's, gone while the turn is out. var own: [4096]u8 = undefined; @@ -294,7 +293,6 @@ test "a wide character counts its cells, not its bytes" { } test "a directory reads as acme lists it: dotfiles kept, . and .. not, directories and links to them marked, sorted bytewise" { - if (comptime !filesystem.platform_has_fs) return; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); const io = testing.io; diff --git a/core/File.zig b/core/File.zig index 325abee9..51773c89 100644 --- a/core/File.zig +++ b/core/File.zig @@ -2312,7 +2312,6 @@ test "a pager's text is a diff when it holds a diff header or a unified hunk" { } test "a long line is painted only around the caret" { - if (!syntax.enabled) return; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 24 }); defer p.deinit(); const line = try std.testing.allocator.alloc(u8, 600 << 10); diff --git a/core/Output.zig b/core/Output.zig index 759bada9..c7bfde14 100644 --- a/core/Output.zig +++ b/core/Output.zig @@ -907,7 +907,7 @@ pub fn openBuild(p: *Pardes, id: usize) !void { @tagName(builtin.abi), @tagName(build_options.platform), }); try w.print("grammars {s}\naddons {s}\nsemantics {x:0>16}\n\ndependencies\n{s}", .{ - if (build_options.grammars == .full) "full" else if (build_options.grammars == .minimal) "minimal" else "none", + @tagName(build_options.grammars), if (build_options.builtin_addons) "compiled in" else "loaded from <prefix>/lib/pardes/addons", @import("wire").semantics, build_info.deps, diff --git a/core/Plumb.zig b/core/Plumb.zig index aeebfc64..f51ddace 100644 --- a/core/Plumb.zig +++ b/core/Plumb.zig @@ -1314,7 +1314,6 @@ test "plumb: a set rewrites the message for good, attr delete of one absent fail } test "plumb: isfile and isdir find a name as Look does, past its place, in the message's directory then Incl's; $file is where" { - if (!fs.platform_has_fs) return; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); try tmp.dir.writeFile(testing.io, .{ .sub_path = "it.zig", .data = "x\n" }); @@ -1482,7 +1481,6 @@ test "plumb: plan9port's basic parses, its ¡- classes UTF-8's bytes and its } test "plumb: the Plumb word opens the plumbing file, include basic until one is saved; saved, or read at boot, its rules are in force, a bad one said with its line" { - if (!fs.platform_has_fs) return; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); var dir_buf: [4096]u8 = undefined; diff --git a/core/Query.zig b/core/Query.zig index 704206e6..ebb44155 100644 --- a/core/Query.zig +++ b/core/Query.zig @@ -2294,7 +2294,6 @@ fn settle(p: *Pardes) void { } test "Find: names fuzzy per keystroke, the group born with its +Preview, nothing else moves, Enter promotes the preview in place" { - if (!filesystem.platform_has_fs) return; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); try tmp.dir.createDirPath(std.testing.io, "src"); @@ -2346,7 +2345,6 @@ test "Find: names fuzzy per keystroke, the group born with its +Preview, nothing } test "Grep: lines of the files under the owner's directory, under their file; All: every pane's, under @pN in serial order, a line once" { - if (!filesystem.platform_has_fs) return; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "b.zig", .data = "const needle = 1;\nconst hay = 2;\nneedle needle\n" }); @@ -2568,7 +2566,6 @@ test "Enter on a frozen query pane's rows after its text was edited: no row to l } test "a query row's place is its text: the match tinted after it, B3 on it opens the place, the rows saved and read again still Look" { - if (!filesystem.platform_has_fs) return; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 48 }); @@ -2627,7 +2624,6 @@ test "a query row's place is its text: the match tinted after it, B3 on it opens } test "the +Preview: the query's hits in its file are its places, the row's one current and selected, coloured as the file is" { - if (!filesystem.platform_has_fs) return; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); const text = "const needle = 1;\nconst hay = 2;\nfn f() void {\n _ = needle;\n}\npub const needle_too = needle;\n"; @@ -2662,7 +2658,6 @@ test "the +Preview: the query's hits in its file are its places, the row's one c sel = pv.body.primaryRange(pv.file.?.content, 0); try std.testing.expectEqual(expected.items[2].start, @min(sel.anchor, sel.head)); // its colours the file's, as its own pane paints them - if (!syntax.enabled) return; var frame = std.heap.ArenaAllocator.init(std.testing.allocator); defer frame.deinit(); _ = try p.render(frame.allocator()); @@ -2674,7 +2669,6 @@ test "the +Preview: the query's hits in its file are its places, the row's one c } test "a row's address is the shortest path a Look from the query pane resolves: in its directory, under it, above it, else absolute" { - if (!filesystem.platform_has_fs) return; if (!pardes.lsp.supports.contains(.references)) return; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); @@ -2716,7 +2710,6 @@ test "a row's address is the shortest path a Look from the query pane resolves: } test "a query row's address reaches every way a look arrives: an empty look written back to event and the whole row written to look, as the mouse on it" { - if (!filesystem.platform_has_fs) return; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 48 }); diff --git a/core/Stream.zig b/core/Stream.zig index 6f99b504..1f4a7405 100644 --- a/core/Stream.zig +++ b/core/Stream.zig @@ -478,7 +478,6 @@ fn parseWork(io: std.Io, job: *TextJob, ctx: ?*anyopaque, sink: Sink) void { } fn now() u64 { - if (comptime !filesystem.platform_has_fs) return 0; const t = std.Io.Clock.awake.now(std.Io.Threaded.global_single_threaded.io()); return @intCast(@max(0, t.nanoseconds)); } @@ -635,10 +634,6 @@ pub fn runHere(p: *Pardes, gen: u32, comptime in_call: bool) void { }; return; } - if (comptime !filesystem.platform_has_fs) { - p.stream.state = .failed; - return; - } const s = &p.stream; if (gen != s.gen or s.state != .searching) return; const job = makeJob(p.gpa, s) catch |err| { @@ -1163,7 +1158,6 @@ const Rogue = struct { }; test "Stream: a stale generation's rows never land in the query pane, however two generations race (walk and rg)" { - if (comptime !filesystem.platform_has_fs) return; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); var root_buf: [4096]u8 = undefined; @@ -1243,7 +1237,6 @@ test "Stream: a stale generation's rows never land in the query pane, however tw } test "Stream: the listing of files for Find on a worker, a cap of hits stops the walk on the loop" { - if (comptime !filesystem.platform_has_fs) return; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); var root_buf: [4096]u8 = undefined; @@ -1273,7 +1266,6 @@ test "Stream: the listing of files for Find on a worker, a cap of hits stops the } test "Stream: a big text's declarations are parsed on a worker, never the loop, and the rows of its / regroup under them" { - if (comptime !filesystem.platform_has_fs) return; const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 40 }); defer p.deinit(); var text: std.ArrayList(u8) = .empty; @@ -1312,7 +1304,6 @@ test "Stream: a big text's declarations are parsed on a worker, never the loop, } test "Stream: a scroll's colours are painted ahead on a worker, so PageDown after PageDown parses nothing on the frame" { - if (comptime !filesystem.platform_has_fs or !syntax.enabled) return; const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 120, .rows = 40 }); defer p.deinit(); var text: std.ArrayList(u8) = .empty; @@ -1355,7 +1346,6 @@ test "Stream: a scroll's colours are painted ahead on a worker, so PageDown afte } test "Stream: a Grep stops at its 2000 lines and waits; More in the query pane's tag goes on" { - if (comptime !filesystem.platform_has_fs) return; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); var root_buf: [4096]u8 = undefined; @@ -1404,8 +1394,7 @@ test "Stream: a Grep stops at its 2000 lines and waits; More in the query pane's } test "Stream: a Grep's rows recoloured are made again, never written, and a dump of them dropped by an edit loads to its digest" { - if (comptime !filesystem.platform_has_fs) return; - if (!syntax.enabled or !syntax.readyApart("c.zig")) return; + if (!syntax.readyApart("c.zig")) return; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); // Rows enough that a digest keeps a word for them (walk's blob_min). @@ -1476,8 +1465,7 @@ test "Stream: a Grep's rows recoloured are made again, never written, and a dump } test "Stream: a Grep's rows are coloured as their file's language colours them, the file painted on a worker, the match tint on top" { - if (comptime !filesystem.platform_has_fs) return; - if (!syntax.enabled or !syntax.readyApart("c.zig")) return; + if (!syntax.readyApart("c.zig")) return; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); const text = "const std = @import(\"std\");\npub fn value() u32 {\n return 42; // value\n}\n"; diff --git a/core/builtins.zig b/core/builtins.zig index 39c06206..991f8a76 100644 --- a/core/builtins.zig +++ b/core/builtins.zig @@ -698,11 +698,9 @@ pub const Fonts = struct { /// Show the declarations enclosing the top row at the pane's head, on or off. pub const TreeContext = struct { - pub const enabled = pardes.syntax.enabled; pub const takes_arg = true; pub fn run(c: Ctx) void { - if (comptime !enabled) unreachable; if (!panes.File.supportsContext(c.pane)) return c.p.reportFailure(c.id, "TreeContext: only a source file the parser knows has context"); const file = &c.pane.file.?; const arg = std.mem.trim(u8, c.arg orelse "", " \t\r\n"); diff --git a/core/config.zig b/core/config.zig index 3dbfe566..f43604ad 100644 --- a/core/config.zig +++ b/core/config.zig @@ -159,7 +159,7 @@ pub const leader_path = paths: { if (builtins.capabilities.pixels) table.set(.GripWidth, null); table.set(.InactiveDim, null); if (builtins.capabilities.pixels) table.set(.Pet, null); - if (builtins.TreeContext.enabled) table.set(.TreeContext, null); + table.set(.TreeContext, null); table.set(.ThemeFile, null); table.set(.DumpThemes, null); table.set(.Mount, null); diff --git a/core/draw.zig b/core/draw.zig index 5ff31af6..b87eb56f 100644 --- a/core/draw.zig +++ b/core/draw.zig @@ -1295,7 +1295,6 @@ test "a wide glyph cut by a tag's or a notice's edge is joined into the grid as } test "a body with context rows is painted once, and the grid's rows are what a plain paint of it gives" { - if (comptime !@import("syntax.zig").enabled) return error.SkipZigTest; const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 60, .rows = 16 }); defer p.deinit(); const pane = try p.setTestFile("pub const Box = struct {\n pub fn run() void {\n" ++ (std.mem.asBytes(&@as([30][21]u8, @splat(" // body line\n".*)))) ++ " }\n};\n"); diff --git a/core/dump.zig b/core/dump.zig index eb0ef263..c348dec2 100644 --- a/core/dump.zig +++ b/core/dump.zig @@ -11,7 +11,6 @@ const exec = @import("exec.zig"); const colors = @import("colors.zig"); const config = @import("config.zig"); const platform = pardes.platform; -const isolated = pardes.isolated; const MAX_PANES = pardes.MAX_PANES; const MAX_COLS = pardes.MAX_COLS; const effect_path_cap = pardes.effect_path_cap; @@ -662,13 +661,11 @@ fn revivePane(p: *Pardes, id: usize, pane: *pardes.panes.Pane, was_on_disk: bool if (pane.terminal != null) { // A command pane comes back finished, showing what it said: its // command is not run again. A host that runs shells starts one - // under the history in the old one's directory; an isolated build - // only shows it. + // under the history in the old one's directory. if (pane.command != null) { pane.command_done = true; return; } - if (comptime isolated) return; if (pane.cwdSlice().len > effect_path_cap) return; // Its shell not there, made ready for a new one: what the old // shell was, ran and said is gone with it (the REPL it ran, the @@ -1060,7 +1057,6 @@ test "a pane restored with unsaved text is asked about by Exit, Restore, Del and test "a loaded terminal's history stays above its banner, the cursor where it was" { if (pardes.Term.ops == null) return error.SkipZigTest; // it reads the emulator - if (comptime isolated) return error.SkipZigTest; const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12 }); defer p.deinit(); @@ -1082,7 +1078,6 @@ test "a loaded terminal's history stays above its banner, the cursor where it wa test "an upgraded session's dump keeps its views and its running terminal as they were, and settings the startup config would change" { if (pardes.Term.ops == null) return error.SkipZigTest; // a shell, dumped and loaded - if (comptime isolated) return error.SkipZigTest; const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true, .cols = 40, .rows = 12, .startup_config = "Verbose off\n" }); defer p.deinit(); diff --git a/core/edit_cmd.zig b/core/edit_cmd.zig index 9f1f7862..9a5c6865 100644 --- a/core/edit_cmd.zig +++ b/core/edit_cmd.zig @@ -610,7 +610,6 @@ test "an Edit whose file is edited while its commands run is refused whole" { } test "X over open files, w, e, r, f, B and D on panes and the disk" { - if (comptime !filesystem.platform_has_fs) return error.SkipZigTest; const gpa = testing.allocator; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); @@ -687,7 +686,6 @@ test "X over open files, w, e, r, f, B and D on panes and the disk" { } test "an Edit's w to a file changed on disk is refused once, as Save is, and the others are written" { - if (comptime !filesystem.platform_has_fs) return error.SkipZigTest; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); try tmp.dir.writeFile(testing.io, .{ .sub_path = "a.txt", .data = "a\n" }); @@ -723,7 +721,6 @@ test "an Edit's w to a file changed on disk is refused once, as Save is, and the } test "an Edit with no command runs beside one whose commands run, unless it touches what that one changes" { - if (comptime !filesystem.platform_has_fs) return error.SkipZigTest; var tmp = testing.tmpDir(.{}); defer tmp.cleanup(); try tmp.dir.writeFile(testing.io, .{ .sub_path = "other.txt", .data = "x\n" }); @@ -784,7 +781,6 @@ test "a session that ends while an Edit's commands run lets the Edit go" { } test "e and r say a file that cannot be read as Get says it" { - if (comptime !filesystem.platform_has_fs) return error.SkipZigTest; const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); const ctl = tree.Node.of(th.serialOf(p), .ctl); diff --git a/core/fs.zig b/core/fs.zig index 0797beb0..6e5829e1 100644 --- a/core/fs.zig +++ b/core/fs.zig @@ -163,7 +163,6 @@ fn osNode(p: *pardes.Pardes, path: []const u8) !u64 { /// outlives the yield, and nothing is staged into the shared reply buffer /// until the turn is back. pub fn osHandle(p: *pardes.Pardes, req: Req) Reply { - if (comptime !platform_has_fs) return Reply.fail(req.tag, E.NOENT); const path = osPath(p, req.node) orelse return Reply.fail(req.tag, E.NOENT); if (req.op == .release) return .{ .tag = req.tag }; const stat = p.tape.site(.os_stat, null, osStat, .{path}) catch return Reply.fail(req.tag, E.NOENT); @@ -307,7 +306,6 @@ pub fn statPath(io: std.Io, path: []const u8, options: std.Io.Dir.StatFileOption /// does: one already there is no failure. A failure shows at the open /// that follows. pub fn makeDirs(tape: *pardes.tape.Tape, dir: []const u8) void { - if (comptime !platform_has_fs) return; if (dir.len == 0) return; tape.site(.make_dirs, null, makeDirsHost, .{dir}); } @@ -320,7 +318,6 @@ fn makeDirsHost(io: std.Io, dir: []const u8) void { /// nearest ancestor that is there may not be searched or written (EACCES: /// `noperm/a/b`, `/proc/1/root/x`). pub fn deniedAbove(dir: []const u8) bool { - if (comptime !platform_has_fs) return false; var at: ?[]const u8 = dir; while (at) |d| : (at = std.Io.Dir.path.dirname(d)) { var z: [4096]u8 = undefined; @@ -443,7 +440,6 @@ fn userHome(name: []const u8) ?[]const u8 { } pub fn resolveOs(tape: *pardes.tape.Tape, path: []const u8, out: *[4096]u8) ?Resolved { - if (comptime !platform_has_fs) return null; var z: [4096]u8 = undefined; const path_z = std.fmt.bufPrintSentinel(&z, "{s}", .{path}, 0) catch return null; return tape.site(.resolve, null, resolveHost, .{ path_z, out }); @@ -676,8 +672,6 @@ fn findEmbeddedSource(path: []const u8, allow_root_suffix: bool) ?Source { return null; } -pub const platform_has_fs = !pardes.isolated; - fn isDir(path: [*:0]const u8) bool { const fd = libc.open(path, .{ .ACCMODE = .RDONLY, .DIRECTORY = true, .CLOEXEC = true }); if (fd < 0) return false; @@ -719,8 +713,8 @@ pub fn restorePath(tape: *pardes.tape.Tape, typed: []const u8, dir_setting: []co fn readFileLimit(tape: *pardes.tape.Tape, gpa: std.mem.Allocator, path: []const u8, limit: usize) ![]u8 { if (std.mem.indexOfScalar(u8, path, 0) != null) return error.OpenFailed; - if (!platform_has_fs or std.mem.startsWith(u8, path, "/virtual/")) { - const archive_path = if (std.mem.startsWith(u8, path, "/virtual/")) path[9..] else path; + if (std.mem.startsWith(u8, path, "/virtual/")) { + const archive_path = path[9..]; var normalized_buf: [4096]u8 = undefined; const normalized = normalizeVirtualPath(archive_path, &normalized_buf) orelse return error.OpenFailed; const source = findEmbeddedSource(normalized, true) orelse return error.OpenFailed; @@ -1215,7 +1209,6 @@ test "self files share the regular file limit without preallocating it" { } test "bounded reads accept exact OS file lengths and empty files" { - if (!platform_has_fs) return error.SkipZigTest; const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true }); defer p.deinit(); @@ -1327,7 +1320,7 @@ test "bounded reads release terminal snapshots after success and size refusal" { } test "bounded reads probe size-unknown proc files at the exact limit" { - if (!platform_has_fs or @import("builtin").os.tag != .linux) return error.SkipZigTest; + if (@import("builtin").os.tag != .linux) return error.SkipZigTest; const gpa = std.testing.allocator; const p = try Pardes.init(gpa, .{ .tty_only = true }); defer p.deinit(); @@ -1379,7 +1372,6 @@ test "self file reads release partial allocations when memory runs out" { } test "oversized OS files fail before allocating their contents" { - if (!platform_has_fs) return error.SkipZigTest; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); const file = try tmp.dir.createFile(std.testing.io, "oversized", .{}); @@ -1481,7 +1473,6 @@ test "a leading ~ is home, from HOME or else the passwd entry" { } test "Restore prefers default directory then falls back to original path" { - if (!platform_has_fs) return error.SkipZigTest; const gpa = std.testing.allocator; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); diff --git a/core/grammar_manifest.zig b/core/grammar_manifest.zig index 711c31a4..b4ff30b9 100644 --- a/core/grammar_manifest.zig +++ b/core/grammar_manifest.zig @@ -5,7 +5,7 @@ const std = @import("std"); -pub const Tier = enum { zig, minimal, full }; +pub const Tier = enum { minimal, full }; pub const Grammar = struct { name: []const u8, @@ -58,7 +58,7 @@ pub const all = [_]Grammar{ \\"#" @keyword \\ }, - .{ .name = "zig", .dep = "ts_zig", .exts = &.{ ".zig", ".zon" }, .tier = .zig }, + .{ .name = "zig", .dep = "ts_zig", .exts = &.{ ".zig", ".zon" }, .tier = .minimal }, }; /// The names a language goes by besides its grammar's: a fence's `py`, diff --git a/core/lib_syntax.zig b/core/lib_syntax.zig index a25af884..f4f85820 100644 --- a/core/lib_syntax.zig +++ b/core/lib_syntax.zig @@ -4,7 +4,7 @@ //! coloured as pardes has it. Nothing is copied here: these are the editor's //! own grammars and highlighting (syntax.zig), themes (colors.zig) and line //! arithmetic (modal.zig), under the names they have there. Whatever is -//! named here compiles with tree-sitter and the grammars alone; test/lib +//! named here compiles with tree-sitter and the grammars alone; test/consumer //! imports it as such a package and holds it to that. //! //! A language is told by a path's extension, as in the editor; `pathFor` @@ -15,7 +15,7 @@ const colors = @import("colors.zig"); const modal = @import("modal.zig"); /// Every grammar pardes knows (`all`), by name or alias (`byName`) and by -/// path (`byPath`). The build's `tree-sitter` option says which of them are +/// path (`byPath`). The build's `grammars` option says which of them are /// compiled in, and `supportsPath` answers for this build. pub const grammars = @import("grammar_manifest.zig"); pub const supportsPath = syntax.supportsPath; diff --git a/core/look.zig b/core/look.zig index 1023a532..1d296775 100644 --- a/core/look.zig +++ b/core/look.zig @@ -7,7 +7,6 @@ const exec = @import("exec.zig"); const Plumb = @import("Plumb.zig"); const config = @import("config.zig"); const diff = @import("diff.zig"); -const platform_has_fs = filesystem.platform_has_fs; const layout = @import("layout.zig"); const modal = @import("modal.zig"); const tagline = @import("tagline.zig"); @@ -1758,7 +1757,6 @@ test "parsePathLine: `end` separates a whole-token target from a lenient read" { } test "lookableSpan peels prose punctuation off a path, largest first" { - if (!platform_has_fs) return; var realbuf: [4096]u8 = undefined; try std.testing.expectEqualDeep( @as(?Span, .{ .start = 0, .end = "core/look.zig".len }), @@ -1782,7 +1780,6 @@ test "lookableSpan peels prose punctuation off a path, largest first" { } test "lookableLineSpan takes the row's location and stops before its text" { - if (!platform_has_fs) return; var realbuf: [4096]u8 = undefined; try std.testing.expectEqualDeep( @as(?Span, .{ .start = 0, .end = "core/look.zig:12:5-9".len }), @@ -1813,7 +1810,6 @@ test "lookableLineSpan takes the row's location and stops before its text" { } test "lookableLineSpan prefers the longest run, so a blank inside a path is one span" { - if (!platform_has_fs) return; var realbuf: [4096]u8 = undefined; const io = std.testing.io; var tmp = std.testing.tmpDir(.{}); @@ -2054,7 +2050,6 @@ test "a pointer resting where a look-hover found nothing does not wake the core } test "Look on each kind of diff line opens the new file at the line it names" { - if (!platform_has_fs) return; const numbered = "line 1\nline 2\nline 3\nline 4\nline 5\nline 6\nline 7\nline 8\nline 9\n" ++ "line 10\nline 11\nline 12\nline 13\nline 14\nline 15\n"; const diff_text = @@ -2116,7 +2111,6 @@ test "Look on each kind of diff line opens the new file at the line it names" { } test "Look on plain diff -u output: names as written, timestamps cut, next to the diff" { - if (!platform_has_fs) return; const diff_text = "--- old/x.zig\t2026-09-30 10:00:00.000000000 +0000\n" ++ "+++ new/x.zig\t2026-09-30 11:00:00.000000000 +0000\n" ++ "@@ -1,2 +1,3 @@\n" ++ @@ -2136,7 +2130,6 @@ test "Look on plain diff -u output: names as written, timestamps cut, next to th } test "Look on a diff: headers and a hunk line's prefix are the whole line, hover and click alike" { - if (!platform_has_fs) return; const numbered = "one\ntwo\nthree\nfour\nfive\nsix\n"; const diff_text = \\diff --git a/src/old.zig b/src/new.zig @@ -2223,7 +2216,6 @@ test "Look on a diff: headers and a hunk line's prefix are the whole line, hover } test "a click, a 9P whole-line look and an empty event write-back take one expansion on every kind of diff line, a blank context line too" { - if (!platform_has_fs) return; const diff_text = \\diff --git a/src/new.zig b/src/new.zig \\--- a/src/new.zig @@ -2286,7 +2278,6 @@ test "a click, a 9P whole-line look and an empty event write-back take one expan } test "every entry point to Look takes one expansion: a diff line and a file:12:5: line land in one place by each" { - if (!platform_has_fs) return; const numbered = "l1\nl2\nl3\nl4\nl5\nl6\nl7\nl8\nl9\nl10\nl11\nline 12 here\nl13\n"; const diff_text = \\diff --git a/src/x.zig b/src/x.zig @@ -2378,7 +2369,6 @@ test "every entry point to Look takes one expansion: a diff line and a file:12:5 } test "a tag word looked at by a click and by Enter is one record to an event reader; an exec on a diff line takes its word, never the address" { - if (!platform_has_fs) return; const diff_text = \\diff --git a/src/x.zig b/src/x.zig \\--- a/src/x.zig @@ -2449,7 +2439,6 @@ test "a tag word looked at by a click and by Enter is one record to an event rea } test "Incl's directories find a name found nowhere else, <name> too; bare Incl lists them, Incl - empties them, and a dump keeps them" { - if (!platform_has_fs) return; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); try tmp.dir.createDirPath(std.testing.io, "inc"); @@ -2489,7 +2478,6 @@ test "Incl's directories find a name found nowhere else, <name> too; bare Incl l test "LookNext in a command pane walks its own file:line places, whoever walked last" { if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane - if (!platform_has_fs) return; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "x.c", .data = "a\nb\nc\n" }); @@ -2546,7 +2534,6 @@ test "Look outside a diff pane expands and looks as ever" { } test "Look on a diff under each git prefix opens the repository's file, and a real a/ directory under --no-prefix" { - if (!platform_has_fs) return; const Case = struct { text: []const u8, file: []const u8 }; const cases = [_]Case{ .{ .text = "diff --git a/src/x.zig b/src/x.zig\n--- a/src/x.zig\n+++ b/src/x.zig\n@@ -1,2 +1,2 @@\n-one\n+uno\n two\n", .file = "/src/x.zig" }, @@ -2573,7 +2560,6 @@ test "Look on a diff under each git prefix opens the repository's file, and a re } test "Look on a diff line is the look of the address it names, selected by hand: a cached patch, the checkout elsewhere" { - if (!platform_has_fs) return; const io = std.testing.io; const patch = "diff --git a/entry/src/entry.rs b/entry/src/entry.rs\n--- a/entry/src/entry.rs\n+++ b/entry/src/entry.rs\n" ++ "@@ -1,2 +1,2 @@\n-fn old() {}\n+fn new() {}\n fn kept() {}\n"; @@ -2635,7 +2621,6 @@ test "Look on a diff line is the look of the address it names, selected by hand: } test "Plumb: a look sends what it looks at, the rules written first: a rule's word or port takes it, a name open in a pane is focused unsent, one nothing takes is Look's own" { - if (!platform_has_fs) return; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); try tmp.dir.writeFile(std.testing.io, .{ .sub_path = "pic.svg", .data = "<svg/>" }); @@ -2687,7 +2672,6 @@ test "Plumb: a look sends what it looks at, the rules written first: a rule's wo test "Plumb: a commit hash looked at in a git work tree is git show's, paged; outside one Diff declines, and the word is searched for" { if (pardes.Term.ops == null) return error.SkipZigTest; // a command pane - if (!platform_has_fs) return; var tmp = std.testing.tmpDir(.{}); defer tmp.cleanup(); try tmp.dir.createDir(std.testing.io, ".git", .default_dir); diff --git a/core/mouse.zig b/core/mouse.zig index 1882b691..465d8a01 100644 --- a/core/mouse.zig +++ b/core/mouse.zig @@ -1819,7 +1819,6 @@ test "a press on a notice's chip is the same state whichever frame this process // The same through a body hit (edit.pointerTextSelection, a sweep's drag), // on a compact body layer (TreeContext), which a pixel shell inverts. test "a body press, drag and release are the same state whichever frame this process drew last" { - if (comptime !pardes.syntax.enabled) return error.SkipZigTest; const gpa = std.testing.allocator; const a = try Pardes.init(gpa, .{ .tty_only = true, .cols = 60, .rows = 16 }); defer a.deinit(); diff --git a/core/replica.zig b/core/replica.zig index 67a29df3..82aa5b32 100644 --- a/core/replica.zig +++ b/core/replica.zig @@ -5003,7 +5003,6 @@ test "a client joined from a dump moves through another view's pane as the sessi } test "a client joined from a dump makes a `/` query's rows as the session does, though only the session has drawn its owner" { - if (comptime !pardes.syntax.enabled) return error.SkipZigTest; const gpa = std.testing.allocator; const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .file = "build.zig" }, TestHost.host(), false); defer a.deinit(); @@ -6541,7 +6540,6 @@ test "a client joined from a dump makes a `/` query's rows as the session does, } } }; - if (comptime !pardes.syntax.enabled) return error.SkipZigTest; const gpa = std.testing.allocator; const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .file = "build.zig" }, .{ .vtable = &WorkerSearch.vtable }, false); defer a.deinit(); diff --git a/core/root.zig b/core/root.zig index 45948189..9509439a 100644 --- a/core/root.zig +++ b/core/root.zig @@ -103,8 +103,6 @@ pub const platform = @import("pardes_options").platform; pub const version = @import("build_info").version; pub const commit: ?[]const u8 = @import("build_info").commit; -pub const isolated = @import("pardes_options").isolated; - pub const font_picker = platform == .gui or platform == .macos; /// Whose turn it is with the core (Turn.zig): one per process, like the diff --git a/core/syntax.zig b/core/syntax.zig index ba3851ab..19831ec2 100644 --- a/core/syntax.zig +++ b/core/syntax.zig @@ -7,17 +7,11 @@ const regexp = @import("regexp.zig"); const c_heap = @import("c_heap"); const diff = @import("diff.zig"); -pub const enabled = config.grammars != .disabled; -const minimal_grammars = config.grammars == .minimal or config.grammars == .full; +const minimal_grammars = config.grammars != .none; const full_grammars = config.grammars == .full; -pub const ts = if (enabled) @import("tree-sitter") else struct { - pub const Language = opaque {}; - pub const Query = opaque {}; - pub const Parser = opaque {}; - pub const QueryCursor = opaque {}; -}; -const ts_queries = if (enabled) @import("ts_queries") else struct {}; +pub const ts = @import("tree-sitter"); +const ts_queries = @import("ts_queries"); const LanguageFn = *const fn () callconv(.c) *const ts.Language; @@ -43,7 +37,6 @@ const Spec = struct { fn grammarSelected(comptime g: grammar_manifest.Grammar) bool { return switch (g.tier) { - .zig => enabled, .minimal => minimal_grammars, .full => full_grammars, }; @@ -92,28 +85,24 @@ extern fn ts_set_allocator( ) void; pub fn start(gpa: std.mem.Allocator) void { - if (comptime enabled) { - std.debug.assert(!syntax_started); - stop(); - syntax_allocator = gpa; - syntax_started = true; - ts_set_allocator(syntax_heap.malloc, syntax_heap.calloc, syntax_heap.realloc, syntax_heap.free); - } + std.debug.assert(!syntax_started); + stop(); + syntax_allocator = gpa; + syntax_started = true; + ts_set_allocator(syntax_heap.malloc, syntax_heap.calloc, syntax_heap.realloc, syntax_heap.free); } pub fn stop() void { - if (comptime enabled) { - for (&specs) |*spec| dropSpec(spec); - forgetLanguages(); - for (&diff_pieces) |*slot| { - if (slot.*) |piece| syntax_allocator.free(piece.styles); - slot.* = null; - } - diff_clock = 0; - ts_set_allocator(null, null, null, null); - syntax_started = false; - syntax_allocator = undefined; + for (&specs) |*spec| dropSpec(spec); + forgetLanguages(); + for (&diff_pieces) |*slot| { + if (slot.*) |piece| syntax_allocator.free(piece.styles); + slot.* = null; } + diff_clock = 0; + ts_set_allocator(null, null, null, null); + syntax_started = false; + syntax_allocator = undefined; } const Selected = struct { @@ -254,7 +243,6 @@ fn runQuery(styles: []u8, sel: Selected, tree: *ts.Tree, base: usize) void { pub fn highlightFileRange(gpa: std.mem.Allocator, path: []const u8, content: []const u8, start_raw: usize, end_raw: usize) ![]u8 { const zone = tracy.zone(@src(), "highlightFileRange"); defer zone.end(); - if (!enabled) return &.{}; const selected = (try forExt(std.Io.Dir.path.extension(path))) orelse return &.{}; const start_byte = @min(start_raw, content.len); const end_byte = @max(start_byte, @min(end_raw, content.len)); @@ -269,7 +257,6 @@ pub fn highlightFileRange(gpa: std.mem.Allocator, path: []const u8, content: []c /// no injections (markdown's and typst's reach the shared parsers), made /// ready here, on the loop, so the worker only reads its query. pub fn readyApart(path: []const u8) bool { - if (!enabled) return false; const selected = (forExt(std.Io.Dir.path.extension(path)) catch return false) orelse return false; return !std.mem.eql(u8, selected.name, "markdown") and !std.mem.eql(u8, selected.name, "typst"); } @@ -278,7 +265,6 @@ pub fn readyApart(path: []const u8) bool { /// parse and a query cursor of its own, the grammar's query shared (it /// is only read); `halt` ends the parse early. After `readyApart`. pub fn highlightApart(gpa: std.mem.Allocator, path: []const u8, source: []const u8, halt: *const std.atomic.Value(bool)) ![]u8 { - if (comptime !enabled) return &.{}; const shared = (try forExt(std.Io.Dir.path.extension(path))) orelse return &.{}; const tree = try parseApart(shared.lang, source, halt); defer tree.destroy(); @@ -335,7 +321,6 @@ pub const ContextDeclaration = struct { }; pub fn supportsPath(path: []const u8) bool { - if (!enabled) return false; return byExt(std.Io.Dir.path.extension(path)) != null; } @@ -345,7 +330,6 @@ pub fn supportsPath(path: []const u8) bool { /// since its parse (`editTree`), the parse reuses what those left alone: a /// character typed into a 9k-line file costs a few hundred µs, not 50 ms. pub fn parseTree(path: []const u8, content: []const u8, old: ?*anyopaque) ?*anyopaque { - if (!enabled) return null; const selected = (forExt(std.Io.Dir.path.extension(path)) catch return null) orelse return null; const tree = selected.parser.parseString(content, @ptrCast(@alignCast(old))) orelse return null; if (held_trees) |h| h.born.append(h.meta, @ptrCast(tree)) catch {}; @@ -357,7 +341,6 @@ pub fn parseTree(path: []const u8, content: []const u8, old: ?*anyopaque) ?*anyo /// places follow the edit; what it says of the edited bytes is stale until /// `parseTree` with it. pub fn editTree(tree: *anyopaque, before: []const u8, old: []const u8, ins: []const u8) void { - if (!enabled) return; const from = advance(.{ .row = 0, .column = 0 }, before); const t: *ts.Tree = @ptrCast(@alignCast(tree)); t.edit(.{ @@ -387,7 +370,6 @@ pub const HeldTrees = struct { }; pub fn freeTree(tree: *anyopaque) void { - if (!enabled) return; if (held_trees) |h| { for (h.born.items, 0..) |t, i| if (t == tree) { _ = h.born.swapRemove(i); @@ -400,7 +382,6 @@ pub fn freeTree(tree: *anyopaque) void { } pub fn destroyTree(tree: *anyopaque) void { - if (!enabled) return; const t: *ts.Tree = @ptrCast(@alignCast(tree)); t.destroy(); } @@ -412,7 +393,7 @@ pub const Span = struct { from: usize, to: usize }; /// The spans `walk` takes the byte range [from, to) to, into `out`; `at` is /// the range's cursor. None when the tree has nothing to say there. pub fn walkNodes(tree_ptr: *anyopaque, walk: NodeWalk, from: usize, to: usize, at: usize, out: []Span) usize { - if (!enabled or out.len == 0) return 0; + if (out.len == 0) return 0; const tree: *const ts.Tree = @ptrCast(@alignCast(tree_ptr)); const lo: u32 = @intCast(@min(from, std.math.maxInt(u32))); const hi: u32 = @intCast(@min(to, std.math.maxInt(u32))); @@ -497,7 +478,6 @@ fn objectQuery(path: []const u8) ?*ts.Query { /// The grammar's indent query for `path` (core/indent.zig) and the /// grammar's name; null when it has none. pub fn indentQuery(path: []const u8) ?struct { *ts.Query, []const u8 } { - if (!enabled) return null; const spec = specFor(path) orelse return null; return .{ lazyQuery(spec, &spec.indents) orelse return null, spec.name }; } @@ -563,7 +543,6 @@ fn matchSpan(q: *const ts.Query, match: anytype, capture: u32, text: []const u8) /// `mi`/`ma`: the smallest `object.inside` (or `.around`) holding byte `at` /// (helix textobject_treesitter). None without a query or such an object. pub fn objectAt(path: []const u8, tree_ptr: *anyopaque, text: []const u8, object: Object, around: bool, at: usize) ?Span { - if (!enabled) return null; const q = objectQuery(path) orelse return null; var buf: [32]u8 = undefined; const want = std.fmt.bufPrint(&buf, "{s}.{s}", .{ objectName(object), if (around) "around" else "inside" }) catch return null; @@ -587,7 +566,6 @@ pub fn objectAt(path: []const u8, tree_ptr: *anyopaque, text: []const u8, object /// previous one ending before it (helix goto_treesitter_object), from the /// first of `.movement`, `.around`, `.inside` the query names. pub fn objectNext(path: []const u8, tree_ptr: *anyopaque, text: []const u8, object: Object, forward: bool, at: usize) ?Span { - if (!enabled) return null; const q = objectQuery(path) orelse return null; var buf: [32]u8 = undefined; const capture = for ([_][]const u8{ "movement", "around", "inside" }) |kind| { @@ -628,7 +606,7 @@ pub const SourceAnalysis = struct { }; pub fn analyzeSource(gpa: std.mem.Allocator, path: []const u8, content: []const u8, want_declarations: bool, want_colors: bool) !SourceAnalysis { - if (!enabled or content.len == 0 or (!want_declarations and !want_colors)) return .{}; + if (content.len == 0 or (!want_declarations and !want_colors)) return .{}; const selected = (try forExt(std.Io.Dir.path.extension(path))) orelse return .{}; const tree = selected.parser.parseString(content, null) orelse return .{}; defer tree.destroy(); @@ -652,7 +630,6 @@ pub fn contextDeclarations(gpa: std.mem.Allocator, path: []const u8, content: [] /// (`parseApart`). `halt` ends the parse and the walk early /// (error.Canceled): a 1.2 MB file is seconds in a Debug build. pub fn declarationsApart(gpa: std.mem.Allocator, path: []const u8, content: []const u8, halt: *const std.atomic.Value(bool)) ![]ContextDeclaration { - if (comptime !enabled) return &.{}; if (content.len == 0) return &.{}; const ext = std.Io.Dir.path.extension(path); const spec = specs: for (&specs) |*spec| { @@ -796,7 +773,6 @@ pub fn highlightLocations(gpa: std.mem.Allocator, content: []const u8, start_byt const start_byte = @min(start_byte_raw, content.len); const end_byte = @max(start_byte, @min(end_byte_raw, content.len)); const source = content[start_byte..end_byte]; - if (!enabled) return &.{}; const styles = try gpa.alloc(u8, source.len); errdefer gpa.free(styles); @memset(styles, 0); @@ -829,7 +805,7 @@ pub fn highlightLocations(gpa: std.mem.Allocator, content: []const u8, start_byt /// padded location column. This also colors context whose location is hidden. /// Consecutive source rows share one parse, retaining multiline syntax. pub fn highlightLocationRows(gpa: std.mem.Allocator, content: []const u8, rows: []const locations.Row) ![]u8 { - if (!enabled or content.len == 0 or rows.len == 0) return &.{}; + if (content.len == 0 or rows.len == 0) return &.{}; const styles = try gpa.alloc(u8, content.len); errdefer gpa.free(styles); @memset(styles, 0); @@ -1111,7 +1087,7 @@ const DiffWindow = struct { }; fn paintDiffPiece(gpa: std.mem.Allocator, window: DiffWindow, bytes: []const u8, at: usize, kinds: []const diff.Kind, path: []const u8) !void { - const selected: ?Selected = if (enabled and syntax_started) (forExt(std.Io.Dir.path.extension(path)) catch null) else null; + const selected: ?Selected = if (syntax_started) (forExt(std.Io.Dir.path.extension(path)) catch null) else null; if (selected) |sel| { const hash = std.hash.Wyhash.hash(std.hash.Wyhash.hash(0, sel.name), bytes); diff_clock += 1; @@ -1269,7 +1245,6 @@ test { } test "every vendored textobject and indent query compiles against its grammar" { - if (!enabled) return; var failed: usize = 0; for (&specs) |*spec| for ([_]Lazy{ spec.objects, spec.indents }, [_][]const u8{ "textobjects", "indents" }) |lazy, what| { if (lazy.src.len == 0) continue; @@ -1285,7 +1260,6 @@ test "every vendored textobject and indent query compiles against its grammar" { } test "syntax context nested Zig containers and multiline function signatures" { - if (!enabled) return; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1317,7 +1291,7 @@ test "syntax context nested Zig containers and multiline function signatures" { } test "syntax context Python class and function body excludes first statement" { - if (!enabled or !full_grammars) return; + if (!full_grammars) return; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1330,7 +1304,6 @@ test "syntax context Python class and function body excludes first statement" { } test "syntax context multiline bindings and C++ namespaces preserve declaration starts" { - if (!enabled) return; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1340,7 +1313,7 @@ test "syntax context multiline bindings and C++ namespaces preserve declaration try std.testing.expectEqual(@as(usize, 1), zig_declarations.len); try std.testing.expectEqual(@as(usize, 0), zig_declarations[0].start_line); try std.testing.expectEqual(@as(usize, 1), zig_declarations[0].header_end_line); - if (!minimal_grammars and !full_grammars) return; + if (!minimal_grammars) return; const cpp_source = "namespace example {\nstruct Outer {\n int run() {\n return 1;\n }\n};\n}\n"; const cpp_declarations = try contextDeclarations(gpa, "nested.cpp", cpp_source); defer gpa.free(cpp_declarations); @@ -1352,7 +1325,7 @@ test "syntax context multiline bindings and C++ namespaces preserve declaration } test "syntax context Rust modules impls and methods remain nested" { - if (!enabled or !full_grammars) return; + if (!full_grammars) return; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1368,7 +1341,7 @@ test "syntax context Rust modules impls and methods remain nested" { } test "syntax formatted locations color hidden context and preserve multiline source" { - if (!enabled or (!minimal_grammars and !full_grammars)) return; + if (!minimal_grammars) return; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1393,7 +1366,7 @@ test "syntax formatted locations color hidden context and preserve multiline sou } test "syntax formatted locations separate alignment from Markdown indentation" { - if (!enabled or !full_grammars) return; + if (!full_grammars) return; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1409,7 +1382,6 @@ test "syntax formatted locations separate alignment from Markdown indentation" { } test "syntax a results row is coloured by the file its location names" { - if (!enabled) return; start(std.testing.allocator); defer stop(); const gpa = std.testing.allocator; @@ -1432,7 +1404,6 @@ test "syntax a results row is coloured by the file its location names" { } test "syntax a buffer with no locations in it keeps no highlights at all" { - if (!enabled) return; start(std.testing.allocator); defer stop(); const content = "nothing has been said yet\n0: save: AccessDenied (x2)\n"; @@ -1460,7 +1431,7 @@ test "syntax codeAfterLocation takes whole-token locations and nothing else" { } test "syntax default full grammar set highlights Typst source" { - if (!enabled or !full_grammars) return; + if (!full_grammars) return; start(std.testing.allocator); defer stop(); @@ -1483,7 +1454,7 @@ test "syntax default full grammar set highlights Typst source" { } test "syntax Typst markup constructs paint and raw blocks inject their language" { - if (!enabled or !full_grammars) return; + if (!full_grammars) return; start(std.testing.allocator); defer stop(); @@ -1527,7 +1498,7 @@ test "syntax Typst markup constructs paint and raw blocks inject their language" } test "syntax markdown highlights markup, injects inline spans and fenced code blocks" { - if (!enabled or !full_grammars) return; + if (!full_grammars) return; start(std.testing.allocator); defer stop(); @@ -1559,7 +1530,7 @@ test "syntax markdown highlights markup, injects inline spans and fenced code bl } test "syntax inline fast path agrees with full Markdown query" { - if (!enabled or !full_grammars) return; + if (!full_grammars) return; start(std.testing.allocator); defer stop(); const selected = (try forLang("markdown_inline")).?; @@ -1606,7 +1577,7 @@ test "syntax inline fast path agrees with full Markdown query" { } test "syntax plain Markdown keeps block styles without starting the inline parser" { - if (!enabled or !full_grammars) return; + if (!full_grammars) return; start(std.testing.allocator); defer stop(); const source = "# Heading\n\nPlain prose.\n\n indented code\n"; @@ -1648,7 +1619,6 @@ test "syntax highlightDiff colors unified diff lines by prefix" { } test "syntax a Zig hunk is coloured as Zig, each side parsed whole" { - if (!enabled) return; start(std.testing.allocator); defer stop(); const diff_text = @@ -1689,7 +1659,7 @@ test "syntax a Zig hunk is coloured as Zig, each side parsed whole" { } test "syntax a Python hunk is coloured as Python" { - if (!enabled or !full_grammars) return; + if (!full_grammars) return; start(std.testing.allocator); defer stop(); const diff_text = @@ -1710,7 +1680,6 @@ test "syntax a Python hunk is coloured as Python" { } test "syntax a deleted file's lines are coloured in its language" { - if (!enabled) return; start(std.testing.allocator); defer stop(); const diff_text = @@ -1730,7 +1699,6 @@ test "syntax a deleted file's lines are coloured in its language" { } test "syntax a hunk in no known language keeps the line colours" { - if (!enabled) return; start(std.testing.allocator); defer stop(); const diff_text = @@ -1747,7 +1715,6 @@ test "syntax a hunk in no known language keeps the line colours" { } test "syntax git diff output in a command pane is told and coloured by its rows" { - if (!enabled) return; start(std.testing.allocator); defer stop(); // A command pane's rows: its command line, then git's output, with one @@ -1780,7 +1747,6 @@ test "syntax git diff output in a command pane is told and coloured by its rows" } test "syntax a section's small hunks share one parse" { - if (!enabled) return; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1802,7 +1768,6 @@ test "syntax a section's small hunks share one parse" { } test "syntax a hunk painted once is kept, and a long one is parsed in pieces" { - if (!enabled) return; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1832,7 +1797,6 @@ test "syntax a hunk painted once is kept, and a long one is parsed in pieces" { } test "syntax result fragments preserve source indentation and inline markup" { - if (!enabled) return; start(std.testing.allocator); defer stop(); const fixtures = [_]struct { path: []const u8, source: []const u8 }{ @@ -1862,7 +1826,6 @@ test "syntax result fragments preserve source indentation and inline markup" { } test "syntax query filtering preserves upstream colors" { - if (!enabled) return; var allocator: std.heap.DebugAllocator(.{ .stack_trace_frames = 0, .safety = true }) = .init; defer if (allocator.deinit() != .ok) @panic("leaked syntax query allocations"); start(allocator.allocator()); @@ -1893,7 +1856,6 @@ test "syntax query filtering preserves upstream colors" { } test "syntax Zig keyword captures cover both bytes beyond line ten thousand" { - if (!enabled) return; start(std.testing.allocator); defer stop(); const code = "pub fn main() void {\n if (true) return;\n}\n"; @@ -1911,7 +1873,6 @@ test "syntax Zig keyword captures cover both bytes beyond line ten thousand" { } test "syntax allocator switching clears default-runtime caches" { - if (!enabled) return; const source = "fn main() void {}"; const initial = try highlightFileRange(std.testing.allocator, "a.zig", source, 0, source.len); std.testing.allocator.free(initial); @@ -1927,7 +1888,7 @@ test "syntax allocator switching clears default-runtime caches" { } test "syntax location context snapshots retain omitted multiline comment scope" { - if (!enabled or (!minimal_grammars and !full_grammars)) return; + if (!minimal_grammars) return; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1953,7 +1914,6 @@ test "syntax location context snapshots retain omitted multiline comment scope" } test "syntax declaration locations clear snapshots without muting ordinary context" { - if (!enabled) return; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1973,7 +1933,7 @@ test "syntax declaration locations clear snapshots without muting ordinary conte } test "syntax stacked addresses do not split multiline source groups" { - if (!enabled or (!minimal_grammars and !full_grammars)) return; + if (!minimal_grammars) return; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -1998,7 +1958,6 @@ test "syntax stacked addresses do not split multiline source groups" { } test "syntax source analysis preserves declarations and injected colors" { - if (!enabled) return; const gpa = std.testing.allocator; start(gpa); defer stop(); @@ -2059,7 +2018,7 @@ test "syntax source analysis preserves declarations and injected colors" { } test "tables are the pipe_tables tree-sitter finds" { - if (!enabled or !full_grammars) return; + if (!full_grammars) return; start(std.testing.allocator); defer stop(); const Tables = @import("Tables.zig"); @@ -2128,7 +2087,6 @@ test "tables are the pipe_tables tree-sitter finds" { } test "a kept tree told its edits parses to the fresh parse's tree, places and all" { - if (!enabled) return error.SkipZigTest; const gpa = std.testing.allocator; const a = "const std = @import(\"std\");\n\nfn f(x: u32) u32 {\n return x;\n}\n\ntest \"t\" {\n _ = f(1);\n}\n"; const old_tree = parseTree("a.zig", a, null) orelse return error.NoTree; @@ -2168,7 +2126,6 @@ test "a kept tree told its edits parses to the fresh parse's tree, places and al } test "syntax: a grammar handed in at run time colours and walks as the one compiled in" { - if (!enabled) return error.SkipZigTest; const gpa = std.testing.allocator; start(gpa); defer stop(); |
