Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Render file patches with a decorated Editor #1512

Merged
merged 402 commits into from
Oct 25, 2018
Merged

Conversation

smashwilson
Copy link
Contributor

@smashwilson smashwilson commented Jun 6, 2018

Use decorations within an Atom TextEditor element to implement a file patch item. This should get us improved performance for large diffs, editable diff support, and open the path for multi-file diff views like a commit or pull request pane.

Just to set proper expectations, I'll likely need to pause and resume this a few times before it lands. Don't worry, I won't forget about it πŸ˜„

Remaining Work
  • Split FilePatchController out into a FilePatchItem, FilePatchContainer, FilePatchController, and FilePatchView, as per Improve React component organizationΒ #1436.
  • Inherit basic item wiring (getTitle(), etc) onto FilePatchItem.
  • Render an <AtomTextEditor> within the FilePatchView.
  • Model: render a FilePatch to the unadorned text that should be displayed within the editor accompanied by the buffer line ranges that correspond to each hunk and line range
  • View: render each group of controls from the original FilePatchView within an appropriately placed Decoration
    • CSS tweaks to keep it looking right
  • Controller: port interactions over and wire 'em up to the right controls
    • Figure out how to preserve selection semantics
  • Update Marker and Decoration components to handle prop changes correctly
  • Correctly and efficiently update FilePatchView decorations when the FilePatch changes due to staging operations
  • Upstream in Atom Multiple, custom line number guttersΒ atom#17736
    • Support custom line numberings in the line number gutter
    • Support the creation of multiple line number gutters
    • Investigate and correct the weird doubled line number labels in custom line-number gutters
    • Write tests for the new gutter code in TextEditorElement's tests
  • Fix StagingView selection sync regression
  • "No changes to display" should be centered in the pane
  • Rework PresentedFilePatch model to unify it with the old model and prevent us from keeping two copies of the diff around
    • Store all patch text in a single String owned by Patch
    • Use an IndexedRowRange to unify an Atom Range with a pair of string offsets
    • Eliminate HunkLine and replace it with IndexedRowRanges within each Hunk that delimit addition and deletion regions
    • Rework partial and complete stage and unstage patch generation
    • Use null objects for missing Files or Patches
    • Unify new model objects within a FilePatch
    • Use a nullFilePatch to signal a missing patch
    • Efficiently determine the Hunk owning a given buffer row
    • Generate old and new line numbers given a buffer row within the patch
    • Use buffer rows to represent lines within a FilePatchSelection
  • Adjust the FilePatchView to use the new model instead of a PresentedFilePatch
  • An empty FilePatch should have navigation controls
  • Restore commands and hotkeys
  • Synchronize the FilePatchSelection and the TextEditor selections
    • Derive the selected patch rows from the current TextEditor selection ranges
    • Handle ctrl- and cmd-clicks and drags on the gutters by adjusting the TextEditor selections
    • Fix patch application
    • Heuristically preserve selection rows when a new FilePatch is generated
    • Suppress setState while the AtomTextEditor is being re-rendered with new content
    • Delete the now-unused FilePatchSelection and its tests
  • Stretch hunk and change region ranges to the end of the last line
  • Catch test coverage up to the speculative work. Get us βœ… again.
  • Store the patch text in a TextBuffer in the Patch model instead of a String
    • Allow an AtomTextEditor to be initialized with an externally owned TextBuffer.
    • Store markers within Regions and Hunks instead of IndexedRowRanges.
    • Organize the markers within a given patch into layers.
    • Create markers instead of IndexedRowRanges in buildFilePatch().
    • Roll a new FilePatch into a previous FilePatch's buffer.
    • Move getHunkAt() into Patch and FilePatch.
    • Allow Markers and MarkerLayers to inherit externally managed resources by ID
    • Decorate Patch-owned MarkerLayers and Markers in FilePatchView.
    • Preserve the buffer when a new FilePatch arrives.
    • Make the CommitView use an external text buffer for the commit message.
  • Re-introduce hunk selections
  • Create a prerelease tag on this branch so that we can dogfood this
v0.19.1-0
  • Fix discarding hunks and lines
  • Stage, unstage, or discard patches with a blank line
  • Correct exception when staging or unstaging the final hunk
v0.19.1-1
  • Correct breakage when decorating destroyed markers
  • Re-introduce the "toggle hunk" keybinding
  • Be less sensitive to stale MarkerLayers when rendering
  • Re-introduce hunk-mode navigation controls
  • Selection decorations only appear on the first row when a row is soft-wrapped
  • "TypeError: Cannot read property 'getMarker' of undefined"
  • Re-render on first click with soft-wrapped lines. Upstream fix: Update soft wrap margins on gutter re-measurementΒ atom#18087
  • Reword "(un)stage selections" buttons to mention lines
v0.19.1-2
  • Include a final empty row in the selected row set
  • TypeError: Cannot destructure property holder of 'undefined' or 'null' when conflicts are encountered
  • Empty diff view when staging and unstaging changes
  • Include keyboard shortcuts in (un)stage selection buttons
v0.19.1-3
  • "Discard changes" regressed again
  • Begin in hunk selection mode
  • βœ… Green tests again checkpoint βœ…
v0.19.1-5
  • Reintroduce + and - indicators in a gutter
  • Improve the context menu on diffs
  • Correct keyboard focus when opening FilePatchItem
  • Track down stalling and failing tests on CircleCI
  • Reintroduce "surfacing" focus to the Git tab with cmd/ctrl-right
v0.19.1-6
v0.22.1-0
  • Integration tests for patch correctness
Concurrent with review
Checks
Stretch goals
Resources

A Guided Tour to that Giant "Files changed" Tab

Fixes #1502. ...Eventually πŸ•

@smashwilson

This comment has been minimized.

@smashwilson

This comment has been minimized.

@annthurium

This comment has been minimized.

@simurai

This comment has been minimized.

@smashwilson

This comment has been minimized.

@smashwilson

This comment has been minimized.

@smashwilson smashwilson merged commit 32c39c2 into master Oct 25, 2018
Feature Sprint : 1 October - 19 November 2018 : v0.21.0 automation moved this from QA Review πŸ”¬ to Merged β˜‘οΈ Oct 25, 2018
@smashwilson smashwilson deleted the aw/file-patch-editor branch October 25, 2018 20:25
@maxbrunsfeld
Copy link
Contributor

maxbrunsfeld commented Oct 25, 2018

power up

@simurai
Copy link
Contributor

simurai commented Oct 25, 2018

I shall remember this PR as "The wall of checkboxes PR". πŸ˜‚

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Use a decorated TextEditor to render file patches
9 participants