VS Code trigger sonar only on save

Is it possible to trigger sonarlint only on save?
When I try to refactor some big legacy file (4k lines+) its not work correctly. I mean its going to big queue of checks, and stuck for a while.

Hello @Volodymyr_Dovhanych,

Thanks for raising this pain point.

Unfortunately there is no way to do that at the moment, apart from disabling SonarLint temporarily which I don’t advise. We could imagine having a setting to let users decide when they want the analysis to be triggered.

I moved your post to the ‘Suggest new feature’ category, let’s see if it gets some traction.

Thanks for using SonarLint!

After thinking a bit more, in complement of what you suggest SonarLint should cancel an ongoing analysis when a new analysis is triggered (it works like this in other IDEs we support). I created tickets here and there to take care of this.

A quick question: what language are you using ? How long does it take for a single analysis to complete ? Do you use refactorings that apply on several files ?
Thanks again!

1 Like

Hello @Damien_Urruty ,
Thank You for your response. I’m using JavaScript, and right now I’m refactoring a big js file. Like 4k lines. Its looks like this:
I split my VSCode into two sides. On the right side, I have opened that big file, and on the left side, I have small components (a couple of files around 100-300lines). Sometimes it’s stuck forever. I mean, faster will be to restart env then wait for it.