Feature: host-defined folded line ranges inside a FileDiff
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- typescript
- Domain
- frontend
Research direction
Start with the FileDiff implementation and trace how collapsedContextThreshold, the virtualizer's height estimates, annotations, and split-view row pairing are handled. Then determine how foldedRanges and expand state should fit those paths, including the stated annotation behavior. Done means ranges render as labeled expandable separator rows, height estimates account for them, and split-view folding behaves as one unit.
Written by the indexing model from the issue text.
Description
Prerequisites
- I have searched for duplicate or closed feature requests
- I have read the contributing guidelines
Proposal
An option on a diff item that lets me name ranges of lines to collapse, the same way collapsedContextThreshold folds unchanged context: one separator row with a customizable label and an expand control, with the virtualizer's height estimates accounting for it.
foldedRanges?: Array<{
side: 'additions' | 'deletions';
start: number; // first line of the run, on that side
end: number; // last line, inclusive
label?: string; // separator text; falls back to "N lines"
}>;
Expand is a lib-owned interaction like the context expander, with onFoldToggle or a controlled expandedFolds so I can keep the state. In split view a range folds both columns as one unit. An annotation whose line is inside a folded range either forces it open or is rejected, whichever is simpler.
Motivation and context
I currently have a feature to compute moved-code (lines of code that moved from file to another unchanged) and paint them through unsafeCSS plus a line annotation carrying the origin. Long runs still make the reviewer scroll past code that exists elsewhere in the same diff. Folding those rows is the natural next step (since it moved unchanged, I display it as a collapsed hunk), and only the lib can do it correctly: it owns row heights, the collapsed-context separators, annotation layout, split-view pairing and line selection.
Version: @pierre/diffs 1.2.11.
Thanks.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 226
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 33
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pierrecomputer/pierre
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pierrecomputer/pierre#1187 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pierrecomputer/pierre#1150 · 3 comments ·
Maintainers usually reply within 1 day
-
Bug: WebKit crashes when drag-selecting text that auto-scrolls a diff (gutter-utility re-parented mid-drag)Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 4/5 3-5 days Newbie friendliness 25/100
pierrecomputer/pierre#1184 · 4 comments ·
Maintainers usually reply within 1 day
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 63/100
pierrecomputer/pierre#1172 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 54/100
pierrecomputer/pierre#1171 · 2 comments ·
Maintainers usually reply within 1 day
All issues in pierrecomputer/pierre
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
area:cowork area:desktop documentation enhancement platform:macos
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
anthropics/claude-code#101720 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
apache/rocketmq-dashboard#6610 ·
Maintainers usually reply within 3 days
-
Add: MS NOWOpencheck:passed streams:add
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Global update drops overrideAccess, so Local API updateGlobal fails filterOptions validation (3.90 regression)Possibly taken @PINYOPATTANAWASANPORN claimed this today. Openarea: core Bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
payloadcms/payload#18674 · 1 comment ·
Maintainers usually reply within 1 day