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

Comment example
  • Click on suggest fix - that copies whole selected line/lines

Comment example
  • Modify lines in the suggestion block. Optionally add more details as normal comment text before or after the suggestion block.

Suggestion example
  • Optionally you can preview suggested edit by clicking on Preview fix when you stop editing comment

Suggestion Draft example
Suggestion Preview

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.

Generate Suggested Edit
  • A user needs to click on "ADD SUGGESTION TO COMMENT" button if they want to use this suggestion. Otherwise the suggestion is never used.

Added Generated Suggested Edit
  • 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.