vscode-pull-request-github
vscode-pull-request-github copied to clipboard
Support the new code review suggestions
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:
In vscode:
Maybe have the suggested changes be shown as a diff? maybe even have a prompt to incorporate the changes, similarly to a merge conflict.
This would be really useful to have it when making reviews through the VS code.
With 589 and this functionality you would be pretty much be able to do the whole PR from VS code!
Does this FR only cover displaying the suggestions made elsewhere or also being able to make suggestions from VS code? Both would be great!
I found this feature very interesting.... is it gonna be put in the roadmap ?
It would be very handy if I could just open a file, make some changes in it and post them as a suggestion.
It would be really big improvements for dev productivity
Any update on this? Currently the suggestion overflow the width of the comment box without anyway to scroll
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.
this would also require https://github.com/microsoft/vscode-pull-request-github/issues/1376
without these two features this plugin is just useless.
without these two features this plugin is just useless.
Your comment is extremely toxic. It does not bring any value to the discussion.
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.
++ 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)
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?
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)
We actually have this feature already (though it's a bit difficult to find)! To use:
- Check out the pull request you want to make a suggestion on.
- Make the code change and stage your suggestion.
- Run the "Suggest Edit" command from either the command palette or the git ... menu.
- The suggestion will show up on the description page as a patch which can be applied.
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.
Thanks @alexr00 for reopening.
We actually have this feature already (though it's a bit difficult to find)! To use:
- Check out the pull request you want to make a suggestion on.
- Make the code change and stage your suggestion.
- Run the "Suggest Edit" command from either the command palette or the git ... menu.
- 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:
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!
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.
I'd love this feature, only downloaded the extension for use this, but I couldn't :(
Is this suggestion being considered?
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.
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 ;)
+1 on adding the ability to make code suggestions as comments, this would be super helpful.
+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"
}
}
+1, ```suggestion block with shortcut/button would be very helpful!
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
- 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).
I'm still working on the remaining functionality. Unintentionally closed by the PR!
There's still room for lots of polish, but the feature is now fully available in the latest pre-release build.