diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-10 03:35:02 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-10 04:08:16 -0300 |
| commit | c40b95b8f938e01b7e8846bae53f16b0c1cd5654 (patch) | |
| tree | 2d9c0ad034bcbb1ed1b1a27a94c79715bee40331 /src/indent.zig | |
| parent | c0ed5f823a37fb1b9b2300f53b23263bfc97a108 (diff) | |
| download | pardes-c40b95b8f938e01b7e8846bae53f16b0c1cd5654.tar.gz pardes-c40b95b8f938e01b7e8846bae53f16b0c1cd5654.zip | |
syntax: a file's kept tree is told each edit (File.edit, ts_tree_edit) and the next parse starts from it, so a new line's indent in a 9k-line Zig file costs the 0.2 ms of what the edit touched, not the 47 ms of a parse anew (3.5 ms → 0.5 ms for 400 lines); not while a rollback copy holds the tree, which an edit in place would change under the copy: that one is left as it was and parsed anew, as is one whose revision moved without it (a twin's edit), by node_tree_edits, the revision its edits reach
Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/indent.zig')
| -rw-r--r-- | src/indent.zig | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/indent.zig b/src/indent.zig index fc2df450..bf52800c 100644 --- a/src/indent.zig +++ b/src/indent.zig @@ -335,7 +335,7 @@ fn expectIndent(path: []const u8, marked: []const u8, want: []const u8) !void { var arena: std.heap.ArenaAllocator = .init(std.testing.allocator); defer arena.deinit(); const text = try std.mem.concat(arena.allocator(), u8, &.{ marked[0..cut], marked[cut + 1 ..] }); - const tree = syntax.parseTree(path, text) orelse return error.NoTree; + const tree = syntax.parseTree(path, text, null) orelse return error.NoTree; defer syntax.destroyTree(tree); const got = try forNewline(arena.allocator(), l, tree, text, std.mem.count(u8, text[0..cut], "\n"), cut); try std.testing.expectEqualStrings(want, got orelse return error.NoIndent); |
