Skip to content

Decorations v3#459

Draft
amadeus wants to merge 131 commits into
mainfrom
amadeus/decorations-v3
Draft

Decorations v3#459
amadeus wants to merge 131 commits into
mainfrom
amadeus/decorations-v3

Conversation

@amadeus

@amadeus amadeus commented Mar 31, 2026

Copy link
Copy Markdown
Member

WIP

@vercel

vercel Bot commented Mar 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pierre-docs-diffs Error Error Jul 8, 2026 11:27pm
pierre-docs-diffshub Error Error Jul 8, 2026 11:27pm
pierre-docs-trees Error Error Jul 8, 2026 11:27pm
pierrejs-diff-demo Ready Ready Preview Jul 8, 2026 11:27pm
pierrejs-docs Ready Ready Preview Jul 8, 2026 11:27pm

Request Review

@amadeus
amadeus force-pushed the amadeus/decorations-v3 branch from c69f24b to c710e4e Compare March 31, 2026 21:55
@amadeus
amadeus force-pushed the amadeus/decorations-v3 branch from 6caaa7c to 69429b4 Compare April 2, 2026 20:21
@amadeus
amadeus force-pushed the amadeus/decorations-v3 branch from 69429b4 to 70ea1c9 Compare April 3, 2026 01:57
@amadeus
amadeus force-pushed the amadeus/decorations-v3 branch from 70ea1c9 to ed0b818 Compare April 3, 2026 18:18
@amadeus
amadeus force-pushed the amadeus/decorations-v3 branch from ed0b818 to 5f13123 Compare April 4, 2026 01:48
@amadeus
amadeus force-pushed the amadeus/decorations-v3 branch from 5f13123 to 591a6ba Compare April 6, 2026 21:13
@amadeus
amadeus force-pushed the amadeus/decorations-v3 branch from 591a6ba to 85a1d55 Compare April 6, 2026 22:20
@amadeus
amadeus force-pushed the amadeus/decorations-v3 branch from 85a1d55 to 3c0ed60 Compare April 6, 2026 22:36
claude Bot and others added 30 commits July 1, 2026 19:34
…uard usage (#914)

Move the monorepo browser baseline to browsers with native Intl.Segmenter
support, which the diffs editor relies on. Firefox 125 is the binding
constraint (Chrome 87+, Edge 87+, Safari 14.1+ are already covered), so
bump firefox >= 120 to firefox >= 125 in .browserslistrc.

Make the editor's Intl.Segmenter usage safe at import time so importing
the editor never throws on engines without it:

- Add createSegmenter() (feature-detected) and a lazily-cached
  getGraphemeSegmenter() in editor/utils.ts, replacing the module
  top-level grapheme segmenter in selection.ts.
- Guard every segmenter call site (word + grapheme in selection.ts, two
  grapheme in textMeasure.ts) with a minimal code-point/regex fallback
  for engines lacking Intl.Segmenter. Behavior is unchanged on supported
  browsers.

Co-authored-by: Claude <noreply@anthropic.com>
* rename

* fix height
To reproduce, in the diff editor on Safari:

1. Click into the additions side.
2. Select all (cmd+a), then press Backspace or Delete.

Nothing is deleted — the additions can't be cleared — though it works
in Chrome.

The editor paints selections with an overlay and leaves the native
selection a collapsed caret. After select-all the caret sits at the
document start, and Safari fires no delete beforeinput when nothing
precedes the caret, so the delete is dropped; Chrome fires it anyway
and deletes via the editor's own selection. Give WebKit a
non-collapsed native selection so it emits the delete; the edit still
runs on #selections, which spans the whole document.

Only rendered lines resolve to DOM nodes and the diff is virtualized,
so anchor the native range to the editable lines currently on screen
rather than the document bounds — otherwise it stays offscreen in a
long file and Safari drops the delete again. A one-shot guard keeps
the resulting selectionchange from reading that shorter range back
over #selections; the next keydown or pointer press (mouse, touch, or
pen) clears it.
* Misc fixes
* Stable updates
* [diffs/editor] Support `moveLineUp` and `moveLineDown` commands

* fix "Clamp moved selections at EOF"

* fix performance: 60ms -> 0.3ms (m4 pro)
1. Open a diff editor with an annotation on an added line.
2. Delete that line, or delete the newline immediately above it.
3. Undo and redo the edit, or insert another line above it.
4. The annotation disappears or fails to return with history.

The annotation mapper only used the aggregate line delta for an edit batch.
That made it guess deleted ranges, drop annotations on deleted lines, and
skip net-zero batches where one edit added lines and another removed them.

Record per-edit line changes on TextDocumentChange and map annotations
through each line edit in order. Keep annotations by moving them to the
nearest surviving line, and refresh touched annotation lists so undo and
redo restore the right annotation state.
A user can trigger the lag like this:
1. Focus an editable diff.
2. Hold Cmd+V or Ctrl+V with text on the clipboard.
3. The editor accepts each repeated paste keydown.
4. Each paste can add lines and make the page fall behind.

The root cause is that a held paste key produces repeat keydown events.
Each accepted repeat can lead to another paste and another expensive diff
update. For multi-line text, that update can recompute diff state from
the full edited document.

Suppress repeated paste keydowns and let the first keydown keep the
existing behavior. This keeps normal paste, including custom clipboard
providers, while blocking the runaway repeat path.
* Phase 1: Add basic CodeView accounting for header/footer

* DOM reconcilation stuff
* Various math-ing stuff
* Lots of verbose comments by claude

* Phase 2: Resize observer/measurement handling

Cleaned up some slop from earlier on the initial measure, but then also
added the ResizeObserver stuff

* Phase 3: Start fleshing out vanilla JS apis

* Phase 4: The React APIs

Took a bit of back and forth from the robot to get on the right solution
that worked within the same confines of before.

* Misc fixes

* Prevent scroll fixing if scrolled to the top and a header component is
  added lazily
* Scroll to should take the header into account

* demo: Add header/footer methods to codeview tests

* tests: add CodeView header/footer tests

* type -> kind

Dunno why, i just prefer that...

* review: ensure height is cleaned up properly

* React re-rendering fixes for react compiler

* PR review

* Fix bugs with missing llms.txt content

* First pass at content for headers/footers
* Slop phase 1

* Slop phase 2

* Phase 1: Adding types for codeview editor support

* Phase 2.1: Add recycling support to editor

* Phase 2.n: The rest of Phase 2's functionality for vanilla JS etc

* Phase 3: React API tweaks

* Phase 4: CodeView edit tests

* Phase 5, Part 1: Fix a variety of issues with the initial CodeView
implemention

* First pass at getting a somewhat editable flow in virtualizer/codeview

* Fix WorkerPool related settings

* Fix up annotations in the new views

* Fix virtualizer strict mode bug

Also adds a test for it

* Add window/element virtualizer variants

It's important to test both versions

* PR review fix

* PR Review Fixes:

Fix some virtualization invalidation issues with Files

* PR Review Fixes 2:

Fix scenarios where a controlled element is removed from CodeView to
ensure it properly fires onItemEditComplete

* Removing some useless ai comments, & code polish

* Fix expandUnchanged jumps that can occur during edit

* Fix a virtualizer out of screen height issue

* fix(diffs/editor): Exclude virtualized host offset from caret scroll-margin

.getScrollMargin folded `fileInstance.top` into the primary caret's
scroll-margin-top. For the original non-virtualized editor that value
was always 0, but on virtualized hosts
(VirtualizedFile/VirtualizedFileDiff, CodeView items) `top` is the
item's offset in scroll content — a coordinate, not a margin. Once
scrolled down a list, the caret carried a scroll-margin-top of thousands
of pixels, so every caret reveal (`scrollIntoView` with block:
'nearest') treated the caret as an oversized box and mis-scrolled —
typically pinning the line being edited to the bottom of the scroll
view, or suppressing the reveal entirely.

The margin now only reserves real viewport space above/beside the caret
(search panel height, gutter width), with a comment explaining why the
host offset must never be folded back in.
* AI slopped deferred updates

* Mb optimize nothing...

Fix tests

* Use CodeViewHandle for scroll tubing

* Add a regression test for stale pooled headers

* Add a regression test for stale slots
* Remove unused file

* Update edit mode feature grid

* more copy edits and mention codeview
* New local input component, update copy and functionality, widen dropdown

* Misc input polish

* Disable 1password bullshits
* Fix bg color in light theme
* Tweak messaging to say saved only in localStorage

* Access Token Tweaks

* Make them read only for now (since we don't support reading/writing comments)
* Improve contents/descriptions

* Tweak to green border on active token

---------

Co-authored-by: Amadeus Demarzi <amadeusdemarzi@gmail.com>
mostly a non-functional changes, a lot of types changes, that I had to
refactor from the AI slop because he really did some ugly shit...
Some AI slop here for sure, but i think we wrangled it into a decent spot.
shit's mb about to get weird...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants