For the time being, SonarLint can "only" trigger the analysis of a source file and this leads to an important constraint : when developing in your favorite IDE, an edited source file needs first to be saved on the disk to be analyzed by SonarLint. If we take the example of IntelliJ IDEA, this is not the default behavior to regularly save changes on disk and so SonarLint forces this behavior (see
This evolution would solve some synchronization issues that we've already started to encounter, see
SLI-33 (when the analysis of a source file is triggered but meanwhile the source file is deleted by the developer)
If we dream a little bit further, we could even imagine tomorrow, SonarLint interacting with analyzers through a protocol like the "Language Server Protocol" (https://github.com/Microsoft/language-server-protocol) to only ask for the analysis of a chunk of code instead of analyzing again the overall source code. This would require analyser to manage an analysis context (see
MMF-556) but this is already something we planned to do. But this is not in the scope of this MMF.
As an IntelliJ developer, I expect to get immediate feedback on my code, without having to wait 2 seconds that SLI forces a save on the file to be able to analyze it.
Here's how this would be achieved:
- Develop this "streaming" API on SonarQube side
- Embed this evolution in SonarLint Core
- Note: the plugin must remain backward compatible with SQ 5.6
- Modify SLI to use this new API
- Note: SLI must be able to work with existing language plugins that haven't been updated to this new API
What about rules that require bytecode to be available and up-to-date?
- => the problem is already there with existing version of SLI
- Out of scope