diff options
Diffstat (limited to 'src/Stream.zig')
| -rw-r--r-- | src/Stream.zig | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/Stream.zig b/src/Stream.zig index 11fa7a31..abdf9afa 100644 --- a/src/Stream.zig +++ b/src/Stream.zig @@ -716,7 +716,7 @@ pub fn receive(p: *Pardes, b: *const Batch) void { } /// A parse's answer: its task joined; the declarations kept as the pane's -/// (File.State.context_declarations, for its revision) when its text is +/// (File.State.context.declarations, for its revision) when its text is /// still what was parsed; the query panes of that text told; and a parse /// asked for while it ran started. fn receiveParse(p: *Pardes, b: *const Batch, serial: u32, revision: u32) void { @@ -729,9 +729,7 @@ fn receiveParse(p: *Pardes, b: *const Batch, serial: u32, revision: u32) void { s.parse_ns = b.took_ns; if (p.paneBySerial(serial)) |id| if (p.panes[id].?.file) |*f| if (f.revision == revision and b.decls.len > 0) { if (p.tree_sitter_gpa.dupe(syntax.ContextDeclaration, b.decls)) |copy| { - if (f.context_declarations.len > 0) p.tree_sitter_gpa.free(f.context_declarations); - f.context_declarations = copy; - f.context_revision = revision; + f.context.replace(p.tree_sitter_gpa, copy, revision); panes.Query.declsArrived(p, serial); } else |_| {} }; @@ -1303,7 +1301,7 @@ test "Stream: a big text's declarations are parsed on a worker, never the loop, try testing.expect(p.stream.parse != null); try testing.expect(std.mem.indexOf(u8, qp.file.?.content, "fn f") == null); const until = std.Io.Clock.awake.now(testing.io).toMilliseconds() + 60_000; - while (pane.file.?.context_revision == null or pane.file.?.context_revision.? != pane.file.?.revision) { + while (pane.file.?.context.revision == null or pane.file.?.context.revision.? != pane.file.?.revision) { if (std.Io.Clock.awake.now(testing.io).toMilliseconds() > until) return error.Timeout; shell.pump(p); p.update(.tick); |
