Suggested changes in Azure DevOps pull requests
In an Azure DevOps pull request, a reviewer can write replacement text for lines into a comment on those lines, and the author can apply it from the pull request page. Below is how it works, from Microsoft's Review pull requests and its screenshots.
Suggest a change
- On the pull request's Files tab, hover over the line and select the comment button. For several lines, select them first and use the comment button that appears over them.
- Select the light bulb under the comment box. It writes a fenced code block that starts with
```suggestion, holding the lines you commented on. - Change the lines inside the block into what they should be, and select Comment. While you type, a Suggested change box under the comment shows the difference.
If accepted, the text in the block replaces the lines the comment is on. There is no light bulb on the original code (the left-hand side of a side-by-side diff): a suggestion changes the pull request's version of the file.
Not the same thing: Approve with suggestions is a vote, which approves and says you have optional ideas (what each vote does). It applies nothing.
Apply a suggestion
- The pull request's author selects Apply change on the Suggested change box. This stages the change; it is not committed yet.
- Commit all changes commits every staged suggestion together, to the pull request's source branch.
- Undo change unstages a suggestion before that.
The commit is a new push to the pull request. If the target branch's policy resets votes on a push, the approvals given so far are gone (when a vote blocks completion). Once applied, reply to the comment or set its status to Resolved (comment status and resolution).
Which versions have it
Azure DevOps Services, Azure DevOps Server 2022 and the current Azure DevOps Server. Microsoft's page for Azure DevOps Server 2020 does not describe suggestions or the light bulb, so on 2020 and older a ```suggestion block is just a code block.
Suggestions posted through the REST API
Microsoft does not document this. A comment on lines is a thread whose threadContext holds the file (filePath) and the lines on the pull request's side (rightFileStart, rightFileEnd); the text of the suggestion is only in the comment. Reports from tools differ: the open-source PR-Agent turns its suggestions into ```diff blocks for Azure DevOps, saying in its source that a ```suggestion block posted through the API shows as a plain block nobody can apply, while other tools post the ```suggestion block as it is. If your tool needs Apply change, try one comment on a test pull request first. Copilot code review in Azure DevOps posts suggestions too (Copilot code review).
Suggestions in IntelliJ IDEA and Rider
Azure DevOps Pull Requests, a plugin by Lesstep for JetBrains IDEs 2024.1 or later and Android Studio, shows a pull request's comment threads in the IDE. Above a ```suggestion block in a comment on lines, it says what the suggestion does, for example "Suggested change: replaces lines 12-14 with the lines below", or that it deletes them when the block is empty, and that you apply it on the pull request page. In a comment that is not on lines, the block shows as ordinary code. The review inbox is free; voting, commenting and completing are Pro (US$1 a month, with a 30-day free trial).
Get it on JetBrains Marketplace
Azure DevOps is a trademark of Microsoft Corporation; IntelliJ IDEA and Rider are trademarks of JetBrains s.r.o. This page is not affiliated with or endorsed by Microsoft or JetBrains.
More: votes · comment status and resolution · Copilot code review · 日本語