Easy and fast way for reviewers to suggest code changes that can be easily applied by the change owner.
Reviewer workflow
-
Select line or multiple lines of diff and start comment
-
Click on suggest fix - that copies whole selected line/lines
-
Modify lines in the suggestion block. Optionally add more details as normal comment text before or after the suggestion block.
-
Optionally you can preview suggested edit by clicking on Preview fix when you stop editing comment
Author workflow
You can apply one or more suggested edits. When a suggested edit is applied it creates a change edit that you can further modify in Gerrit. You can read more about all the features of change edit mode.
FYI: Publishing a new patchset in Gerrit will make your Gerrit change out of sync with your local git commit. You can checkout the latest Gerrit patchset by using the commands from the download drop-down panel.
Alternatively, you can use the copy to clipboard button to copy a suggested edit to your clipboard and then you can paste it into your editor.
Generate Suggestion
Following UI needs to be activated by a plugin that implements SuggestionsProvider. Gerrit is providing just UI.
-
When a user types a comment, Gerrit queries a plugin for a code snippet. When there is a snippet, the user can see a preview of snippet under comment.
-
A user needs to click on "ADD SUGGESTION TO COMMENT" button if they want to use this suggestion. Otherwise the suggestion is never used.
-
By clicking on "ADD SUGGESTION TO COMMENT" button, the suggestion is added to end of comment. The user can then edit the suggestion, if needed.
Part of Gerrit Code Review