Fixing your code issues
Depending on the issue, you may get fix suggestions:
- In the How can I fix it? tab of the issue's detail view.
- From the Team plan, generated through AI: see Getting AI-generated fix suggestions below.
Opening issues in your IDE
To speed up the time it takes to find and fix the issue, you can open the issue in your IDE provided the Connected Mode has been properly set up in order to connect SonarLint with SonarCloud.
If you’ve already fixed the issue in your code, SonarLint will not be able to find it in the IDE; only matching code will be highlighted. Keep in mind that the revision or branch analyzed by SonarCloud may not be the same as what you have opened in the IDE. When setting up Connected Mode, SonarLint considers the branch currently checked out in the IDE and tries to synchronize it with the most appropriate branch from the server (This is called branch matching in SonarLint).
To open an issue in your IDE:
- Retrieve the issue and open its detail view as described above in Retrieving issues.
- Select the Open in IDE button.
Getting AI-generated fix suggestions
This feature is available in Early Access, in the Team and Enterprise plans.
When AI-generated fix suggestions are activated in your organization, you can get an AI-generated fix suggestion for each issue detected in your project. To do this:
- Inside a project, go to the Issues page and select an issue.
- From the Where is the Issue tab or the AI CodeFix tab, click the Generate Fix button.
You can then copy a generated fix to your IDE:
- manually, by copying and pasting the suggestion in your IDE.
- using the AI CodeFix > View Fix in IDE button if you use Connected Mode. This option is available when working with SonarLint for VS Code, IntelliJ, and Eclipse.
Note that for some issues, AI-generated fix suggestions are not available.
Was this page helpful?