This repository was archived by the owner on Dec 15, 2022. It is now read-only.
This repository was archived by the owner on Dec 15, 2022. It is now read-only.
Use a decorated TextEditor to render file patches #1502
Closed
Description
Scaling the rendering performance of the FilePatch items has always been a problem for us, because we render DOM elements for every line of every diff. It's a lot of work for React and it's a lot of work for the DOM. We've put a band-aid on this by not rendering diffs that are more than 32k bytes, but especially if we want to use a patch view to do things like show the full diff of a commit or a pull request, we'll reach that limit pretty quickly.
So, let's re-implement FilePatch rendering as decorations in one of Atom's TextEditors. That gets us tiling and scaling and a ton of black-magic rendering performance improvements.
The cool thing is, this will get us editable diffs too. ✨
To replicate the existing patch view, we'll need:
- A header decoration that shows the staged status, path, and file-level controls.
- A hunk decoration that shows the hunk header, stage or unstage controls, and a discard control
- A custom gutter to show the line numbers from both sides in two columns
- Line decorations for added/removed lines within each hunk and highlighting the current selection
- Interaction modes: hunk selection, line selection, and edit