Feature: LSP navigation updates diffs #538
Open
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.
Describe what this PR does / why we need it
When you navigate using LSP or a command like
gf
while reviewing a change using theuse_local_fs
option, you lose the diff, even if the file you navigated to was part of the change.This change allows you to navigate around a PR's changed files using your LSP
Screen.Recording.2024-04-20.at.19.05.43.mov
Does this pull request fix one issue?
Fixes #535
Describe how you did it
Review layouts keep track of
files
, these are the files that you see populated in the files pane after opening a review.After entering a buffer, if the filepath is not
octo://...
, I assume that it is a local file and I check whether the file is part of the layout'sfile
's. If it is then I update the review to that file usingreview.layout:set_file(file)
Describe how to verify it
You need to use
use_local_fs
and review a PR that has multiple files, where you can navigate between those files via LSP.Special notes for reviews
There is some unintended behaviour with this change. When you navigate to the right buffer in the diff you see this message:
It doesn't happen if I comment out
review.layout:set_file(file)
in my change, so I assume that the side-effects of this are triggering more autocomands