From 20cbd62897519355d4680267064711d829ef5800 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 22 Nov 2026 00:38:01 -0300 Subject: layers: `Churn [window]` (slice 7): for each declaration of a file's pane (tree-sitter's innermost, as TreeContext finds them: `f.context.declarations`), how many of the window's changes touched it, shown in this view as a heat lane after the line number (a half block, before the changes' lanes, which stay next to the text they mark: `File.Layers.heat`, one cell) and as a strip by the scroll thumb (a rail row each, the hottest of its lines: the rail's second cell in a terminal, `Surface.heat` for a window, drawn beside the track by gui.zig's paneDecor), smooth from the line numbers' grey to the theme's red (`jj.themeRed`) in Oklab on a log scale of the count against the file's hottest (`heatColour`); the window a revset, or a span of time back from now (`3d`, `2w`, `6m`, `1y`: `::(REV) & author_date(after:"N units ago")`), bare shown here or not and with none counted yet the file's whole history `::(REV)`; jj's data as `Changes`' is: one `jj log` of the window and the changes after it to the shown revision with their hunks (the same query and marks, `Ask.kind` `.churn`) and `jj file show` of the revision (to line the counts up with the pane's text, `Moved.of`), on the worker, its raw answer an input; kept raw in the session's jj state (`jj.Heat`, `Session.heats`) until the text's declarations are there, then counted in every process (`heatOf`, `parsed`): a big file's parse is a worker's (`Stream.parseFor`, its landing tells `jj.parsed`), never the loop's (counted on the loop, core/replica.zig held a Debug loop 1,211 ms; now its longest hold is 10.7 ms; the counting itself 1 ms); a change counts once a declaration, a hunk's lines carried to the shown revision through the later changes' hunks; the counts ride with the lines through edits (`spliceValues`, shared with `Changes`' lines); a later ask of the other kind no longer drops an answer (the stale check is per kind); tests: f three changes, g two: `3 3 3 0 2 2 2`, the cell red on f, `mixOklab(grey, red, ln 3 / ln 4)` on g, none on the blank line, the strip's first row red, in a terminal and a window, bare off and on without asking jj; `@--::@` one each, `1w` all, a refusal in jj's words; on a worker, counted when the worker's parse lands, the client equal; a line deleted takes its count, the client and digest equal; core-test 912/1072 (160 skipped), shell-test 1114/1117 (3 skipped) Co-Authored-By: Claude Opus Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T --- core/Stream.zig | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/Stream.zig') diff --git a/core/Stream.zig b/core/Stream.zig index 1d061b52..7956e4f2 100644 --- a/core/Stream.zig +++ b/core/Stream.zig @@ -735,6 +735,8 @@ fn receiveParse(p: *Pardes, b: *const Batch, serial: u32, revision: u32) void { } else |_| {} }; p.needs_frame = true; + // A `Churn` waiting on these declarations (jj.zig). + @import("jj.zig").parsed(p, serial); if (s.parse_next) |next| { s.parse_next = null; if (p.paneBySerial(next.serial)) |id| parseFor(p, id); -- cgit v1.3