Repository navigation
feat(panel): the diff bundle draws a whole file, and notes under one patch's lines - #4262
Merged
Merged
Conversation
…patch's lines mountFile draws a whole file with no diff through Pierre's CodeView holding the one file: virtualized, coloured in the kept pool, its lit lines Pierre's own, notes under their lines in the view's elements, lines picked by their numbers or a text selection, and its numbers left out of the find and of what a screen reader reads. mount takes notes under its lines again, for the Code cards' snippets. Co-authored-by: luke-agent[bot] <339870089+luke-agent[bot]@users.noreply.github.com>
…t a pick go with its file Co-authored-by: luke-agent[bot] <339870089+luke-agent[bot]@users.noreply.github.com>
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is PR 1 of the approved plan Pierre for File tabs and code snippets (plan page). It adds the two capabilities the rest of the stack needs to the lazy diff bundle (
packages/panel/src/diff-view/). Nothing in the app calls them yet, so nothing visible changes.mountFile(host, props)draws a whole file with no diff, as the File tab, a page's source and the text-attachment viewer will (PR 2 and PR 5).CodeViewholds onetype: 'file'item. Only the lines near the view are drawn, whatever the file's length. Colours come from the same kept worker pool as Files changed (perf(desktop): highlight Files changed off the main thread #3752), and the file shows as plain text until they arrive.AGENTS.md.lituses Pierre's own selected lines, the same call Files changed uses to light a thread's lines. The bundle sets them withnotify: false, so Pierre doesn't report them as the reader's pick.renderAnnotation(key)), as the list does.pickedLines(): returns the lines picked by pressing their numbers (GitHub-style, with ⇧ to extend). Otherwise it returns the lines a text selection in the shadow root covers. ⌥⌘K will use this.revealLines(range): centres a range at once.FIND_SHADOW_ATTRIBUTE, so the tab's find reads it and skips the gutter. The gutter is markedaria-hidden, so a screen reader doesn't read every number and then every line.onDrawn: called whenever Pierre draws rows, so a find source can repaint its matches (PR 2).mounttakesannotationsandrenderAnnotationagain. feat(desktop): list every file in Files changed, with a filter, collapse all, and stage-cli's keys #3304 removed them. The Code tab and inbox cards (PR 4) use them to put Luke's note under a snippet's last line.No service change.
Measured
This is the same throwaway harness as the plan, now running the built
diff-view.js'smountFile, with the CSSOM inline-style path and the build's worker. Setup: a 5,000-line TSX file in headless Chromium at 1280×800, a 720px pane, median of 3. Today's numbers come from today'sCodeLinesViewgiven every window up front with host colours. Both columns were measured in the same session.mountFileFirst colour took about 3.3 s on this session's slower sandbox. That matches the plan's prototype measured in the same session (3.4–3.5 s), so the real bundle adds nothing on top of Pierre. The developer accepted late colours on big files.
renderer/diff-view.js: 243,477 → 245,160 gzipped bytes (+1.7 KB), inside the budget's 5% slack.panel.jsis unchanged.Tests
New file
diff-view/whole-file.test.ts(8 tests). Pierre draws in jsdom on the main thread:The four stand-in bundles in the tab tests gain
mountFile.Evidence
tsc --noEmit(panel): clean../scripts/oxlint.sh: 0 warnings, 0 errors.biome check: clean.knip: no new findings../scripts/repository-checks.sh: passed.src/diff-viewplus the changes, chapters, pull request and themed-lines tab suites, 14 files, 235 tests passed.apps/desktopbuild: passed.Invariants
astype assertion, raw async primitive, or Effect run outside the edges.PRIVACY.mdunchanged: the file view's root stays under the File tab'sph-no-capture(PR 2).Made with Luke