feat(code-editor): add collapse unchanged lines extension with expand…#1342
Open
CaioDGallo wants to merge 1 commit intoPostHog:mainfrom
Open
feat(code-editor): add collapse unchanged lines extension with expand…#1342CaioDGallo wants to merge 1 commit intoPostHog:mainfrom
CaioDGallo wants to merge 1 commit intoPostHog:mainfrom
Conversation
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.
Problem
The built-in
collapseUnchangedoption from@codemirror/mergedoesn't support gradual expand controls (expand up/down N lines). Users viewing diffs with large unchanged regions had no way to incrementally reveal context; they could only see the collapsed placeholder or load full ranges of unchanged lines between diffs.Closes #1341
Changes
collapseUnchangedwith an expand-enabled collapse widget. Unchanged regions are collapsed with up/down arrow buttons to expand 20 lines at a time, plus a "N unchanged lines" label that expands all. Expand actions are synced across both sides of split-merge views viamergeViewSiblings.collapseUnchangedconfig and wired the new extension into both split and unified merge views. The extension is skipped whenloadFullFilesis true..cm-collapsedLinesgradient styles with new.cm-collapsed-context,.cm-collapsed-gutter,.cm-collapsed-expand-btn, and.cm-collapsed-labelstyles supporting light/dark themes with hover states.mapPosBetweenSides,buildDecorations,applyExpandEffect(expand up/down/all), andcomputeInitialRanges(mocked viabuildDecorationsassertions).How did you test this?
loadFullFilestoggledFeature Examples
Before
After