Fix commenting on added files in the Commits tree - #8866
Open
Artur Czuba (artur-czuba-iyuno) wants to merge 1 commit into
Open
Fix commenting on added files in the Commits tree#8866Artur Czuba (artur-czuba-iyuno) wants to merge 1 commit into
Artur Czuba (artur-czuba-iyuno) wants to merge 1 commit into
Conversation
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.
When a file added by a commit is opened from the Commits node, the right-hand side of the diff is given
parentFilePath— areviewURI withbase: true.ReviewCommentController.provideCommentingRangesthen callsgetCommentingRanges(hunks, isBase: true), which builds ranges only fromDeletediff lines. An added file has none, so no commenting ranges are produced and the+never appears in the gutter. The extension log shows:The head side of the diff should use
filePathinstead. TheDELETEcase is left as it is: the content of a deleted file lives on the base side, and so does the comment.This has been the behavior since #2334, so it is not a recent regression.
Testing
New
src/test/view/treeNodes/gitFileChangeNode.test.tscovers both branches — that an added file is diffed against the head side, and that a deleted file keeps using the base side.Verified manually against a checked out pull request: added files under a commit in the Commits tree now offer the
+in the gutter and accept a comment.Note
I have a second change that builds on this one, for commenting on files from earlier commits of a pull request (refs #4315). Keeping it separate since this fix stands on its own.