vscode-pull-request-github icon indicating copy to clipboard operation
vscode-pull-request-github copied to clipboard

Support the new code review suggestions

Open Tadaboody opened this issue 5 years ago • 25 comments

Github announced a new suggestion api that started being added to the code review tools. Right now the extension takes these at face value as text.

For example take this comment.

In github:

image

In vscode:

image Maybe have the suggested changes be shown as a diff? maybe even have a prompt to incorporate the changes, similarly to a merge conflict.

Tadaboody avatar Oct 23 '18 13:10 Tadaboody

This would be really useful to have it when making reviews through the VS code.

glemaitre avatar Jan 28 '19 13:01 glemaitre

With 589 and this functionality you would be pretty much be able to do the whole PR from VS code!

mledom avatar Jan 30 '19 14:01 mledom

Does this FR only cover displaying the suggestions made elsewhere or also being able to make suggestions from VS code? Both would be great!

melink14 avatar Sep 14 '19 21:09 melink14

I found this feature very interesting.... is it gonna be put in the roadmap ?

jonathanvila avatar Apr 17 '20 15:04 jonathanvila

It would be very handy if I could just open a file, make some changes in it and post them as a suggestion.

arubtsov avatar Apr 21 '20 13:04 arubtsov

It would be really big improvements for dev productivity

Draal avatar Aug 27 '20 00:08 Draal

Any update on this? Currently the suggestion overflow the width of the comment box without anyway to scroll image

ankitbko avatar Apr 12 '21 16:04 ankitbko

Yes, this feature would be very useful. Currently we can add suggestions (using ```suggestion) but they don't show up properly. For example, the suggestion to remove a line does is not displayed at all.

sahmadi-wave avatar Apr 16 '21 21:04 sahmadi-wave

this would also require https://github.com/microsoft/vscode-pull-request-github/issues/1376

without these two features this plugin is just useless.

georgfaust avatar Jun 17 '21 16:06 georgfaust

without these two features this plugin is just useless.

Your comment is extremely toxic. It does not bring any value to the discussion.

glemaitre avatar Jun 22 '21 16:06 glemaitre

without these two features this plugin is just useless.

Your comment is extremely toxic. It does not bring any value to the discussion.

you're right sorry. Just being frustrated finding no tools to make reviews outside of the Github webgui. Even jetbrains can't do it.

georgfaust avatar Jul 03 '21 15:07 georgfaust

++ for this suggestion!

I'd also note that it could be extremely useful if a user shifts into "PR Review Suggestion Mode" so that any code changes made in VS Code's editors were batched as PR Comment code change suggestions.

(but even a basic implementation would be extremely helpful)

EthanJStark avatar Sep 02 '21 14:09 EthanJStark

So just to check my understanding, currently the best way to make code suggestions (especially code suggestions for multiple lines of code) is to use GitHub's online GUI. Is that right?

Lovkush-A avatar Sep 05 '21 08:09 Lovkush-A

For single line changes (since #1376 is still open), you can manually type:

```suggestion
  your suggestion
\```

(ignore that slash though—I just don't know how to escape backticks in markdown)

0x24a537r9 avatar Oct 02 '21 05:10 0x24a537r9

We actually have this feature already (though it's a bit difficult to find)! To use:

  1. Check out the pull request you want to make a suggestion on.
  2. Make the code change and stage your suggestion.
  3. Run the "Suggest Edit" command from either the command palette or the git ... menu.
  4. The suggestion will show up on the description page as a patch which can be applied.

alexr00 avatar Nov 17 '21 14:11 alexr00

Thanks @alexr00 for the info. However, this is not corresponding to the feature that was requested.

Here, the "Suggest Edit" will create a patch. Via the extension interface, it can be applied but via the web interface, it cannot. Thus, a contributor that does not use the GitHub extension cannot accept the suggestion and he will just end up with a git diff. Depending on the expertise of the contributor with git, I am not sure that dealing with such a patch is easy.

In addition, a suggestion is sometimes coming with an additional explanation to argue the importance of the suggestion or the reasons to suggest such a modification. Currently, the proposed methodology is not allowing such a feature.

I see it maybe as an incomplete workaround and I would suggest letting the issue open until the exact same feature on the web interface and vs code extension is implemented.

glemaitre avatar Nov 17 '21 16:11 glemaitre

Thanks @alexr00 for reopening.

glemaitre avatar Nov 18 '21 09:11 glemaitre

We actually have this feature already (though it's a bit difficult to find)! To use:

  1. Check out the pull request you want to make a suggestion on.
  2. Make the code change and stage your suggestion.
  3. Run the "Suggest Edit" command from either the command palette or the git ... menu.
  4. The suggestion will show up on the description page as a patch which can be applied.

Great tip, thanks! This is better than nothing, but as others have mentioned, it doesn't result in a patch that can be applied in the web UI. In case anyone is wondering what it looks like, this is the result:

image

i.e. It posts a comment containing a markdown code block formatted with the diff lang.

Another quirk I noticed is that this applies the comment immediately, even if you are in PR review mode. This can be a bit confusing as the author of the PR will get notification spam for each suggestion, and then only later when you submit the review will they see the rest of the comments. In addition to the spam problem, this can be confusing when reading comments, because the author simply sees a "suggested change" with no context as to why you're suggesting it.

Perhaps a "suggestion" (😏 ) for improving this feature would be to allow posting a message along with the diff. Maybe it could be implemented as a second step in the command palette.

Anyway, the feature that leaves a diff in a comment is not too bad – thanks for the extension!

milesrichardson avatar Jan 04 '22 22:01 milesrichardson

We actually have this feature already (though it's a bit difficult to find)!

Not really. You have a feature to suggest a change as a patch in a comment but it's not using GitHub's suggestion facility as it does not provide the reader with the tools that suggestion facility provides to be able to apply the suggestion right from the UI.

So while you have similar feature, it does not satisfy the original request, IMO.

brianjmurrell avatar Feb 12 '22 20:02 brianjmurrell

I'd love this feature, only downloaded the extension for use this, but I couldn't :(

MattContassot avatar Feb 18 '22 17:02 MattContassot

Is this suggestion being considered?

lrweck avatar Apr 17 '22 23:04 lrweck

Now that microsoft/vscode#146510 is landed this feature is closer to being achievable.

I wonder if the UX for it can be nicer than GitHub's. Maybe by allowing some kind of in-place/in-editor changing while reviewing and some button that makes that a ```suggestion in the comment. Or maybe just saving a change in the editor while in review mode turns the edit into a suggestion.

brianjmurrell avatar Apr 21 '22 16:04 brianjmurrell

Now that https://github.com/microsoft/vscode/issues/146510 is landed this feature is closer to being achievable.

This is super nice.

Some button that makes that a ```suggestion in the comment.

With a small keyboard shortcut ;)

glemaitre avatar Apr 21 '22 16:04 glemaitre

+1 on adding the ability to make code suggestions as comments, this would be super helpful.

ant0nsc avatar May 30 '22 09:05 ant0nsc

+1 for button that would wrap content with ```suggestion block like it is done on GitHub. Current workaround I use is having a snippet and having it on a keybinding.

You have to copy text into clipboard with ctrl+c and then paste suggestion using ctrl+alt+x

code snippet

	"Add github text suggestion": {
		"body": [
			"```suggestion",
			"$0$CLIPBOARD",
			"```"
		],
		"description": "Wraps text in clipboard with ```suggestion block"
	}

key binding

    {
        "key": "ctrl+alt+x",
        "command": "editor.action.insertSnippet",
        "when": "github:activePullRequest.visible",
        "args": {
            "name": "Add github text suggestion"
        }
    }

danipoma avatar Jun 05 '22 10:06 danipoma

+1, ```suggestion block with shortcut/button would be very helpful!

albertusdev avatar Nov 07 '22 14:11 albertusdev

There are several parts that will need to be done here:

  • Show ```suggestion blocks in some way in the comment widget (https://github.com/microsoft/vscode-pull-request-github/pull/4248)
    • The comment widget just allows markdown, no HTML, so we will likely not be able to show a nice little diff like GitHub does
  • Apply ```suggestion blocks in the comment widget (also in progress in https://github.com/microsoft/vscode-pull-request-github/pull/4248)
  • Have a button that inserts the ```suggestion + text editor content for when you're authoring a comment
    • Requires new API in VS Code

alexr00 avatar Nov 25 '22 16:11 alexr00

  • Have a button that inserts the ```suggestion + text editor content for when you're authoring a comment
    • Requires new API in VS Code

Is there an issue to track this work? The feature as written in #4248 is indeed extremely helpful, and will be very much welcomed, but does not replicate the functionality in the GH web interface (as has been noted several times).

curtisgibby avatar Dec 21 '22 16:12 curtisgibby

I'm still working on the remaining functionality. Unintentionally closed by the PR!

alexr00 avatar Dec 21 '22 16:12 alexr00

There's still room for lots of polish, but the feature is now fully available in the latest pre-release build.

alexr00 avatar Dec 23 '22 12:12 alexr00