From c40b95b8f938e01b7e8846bae53f16b0c1cd5654 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 03:35:02 -0300 Subject: 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 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/indent.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/indent.zig') 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); -- cgit v1.3