Programming language you’re coding in: Typescript / Node.js
Is connected mode used:
Connected to SonarQube (and which version): Community Edition Version 10.4 (build 87286)
And a thorough description of the problem / question:
When I try to connect SonarLint with SonarQube, and bind project, i see in output console from VSCode this message : [Info - 18:47:07.757] Skipping text document analysis because workspace folder is not synchronized yet “-filename-”.
This message appears every time I open or edit a file, and therefore, no issues are displayed on vscode while there are dozens on sonarQube.
A priori, there is no other error, the project seems correctly bound, the key is correct, the synchronization of the rules seems correct too.
I tried uninstalling and reinstalling sonarLint, removing the connection with SonarQube and re-creating it, restarted VSCode, updated everything, nothing changes.
Now, I uninstalled again SonarLint, removed all configuration relative to the extension from vscode, reinstalled SonarLint without change anything in the default configuration. I removed the “sonar-project.properties” of my project, and the linter wont work, and I have the same message in output console : “Skipping text document analysis because workspace folder is not synchronized yet”, again and again.
EDIT :
I noticed this: When I open the project folder A: SonarLint does not want to analyze the files in folder A (same error message), on the other hand if, on VSCode, I “open a file” coming from project B, then SonarLint will analyze it.
This behavior is identical when I open the folder of project B: No file is analyzed, and when I open a file from project A, then SonarLint wants to analyze this file.
Thanks for the detailed description! I tried reproducing it on my side and while the project is synchronizing I also see the same log line about skipping analysis (which is expected), but after a few seconds once the sync is complete, analysis takes place and I can see issues as expected.
Would you be able to provide full SonarLint logs as described here?
Any further details or hints on how to reproduce are more than welcome!
I don’t really know what else to say. Sonarqube is hosted by me and works correctly, the connection between sonarqube and vscode also seems correct. There are around a hundred issues that I have to process and which are reported correctly on SonarQube.
The only thing missing is that the information goes back to SonarLint.
Unfortunately, we don’t see anything clearly wrong there, and cannot reproduce the problem ourselves either. Early next week we will be able to share with you a pre-release artifact of SonarLint for VSCode that will log more extensively the steps happening during project synchronization. We would really appreciate it if you could give it a try.
I will post the update in this thread. In the meantime, you might choose to keep using the previous version 4.3.
Sorry for the inconvenience and thanks again,
Sophio
Would you prefer that I don’t touch anything until then so that you might be able to find something in the more detailed logs? Even if I don’t have much idea what to do to resolve the situation, the only things I haven’t tried yet is to reinstall VSCode, or to test on another IDE.
I get the exact same issue using the VSCode SonarLint extension (v 4.4.1) analyzing Java files - the log output reads “Skipping text document analysis because workspace folder is not synchronized yet”.
I tried restarting VSCode, selecting different projects, reinstalling SonarLint, etc., all to no success. But downgrading to v 4.3 fixed the problem.
“I also encountered the same problem when writing Python, it won’t analyze the files in the current folder, but it can for files in other folders. I have now downgraded to 4.3.0.”
I’ll list “unusual” things that come to mind about by setup that might be causing this bug:
The workspace is located on a different drive than the OS and VS Code.
I use git worktrees to be able to work on multiple copies of the project at once while sharing the same local git repository. The issue seems to happen even in the main worktree, though, which I wouldn’t expect to trip something up.
I don’t see anything in it that obviously indicates the source of the error. The following warnings are probably unrelated:
Using ${workspaceFolder} variable in sonarlint.pathToCompileCommands is only supported for files in the workspace
This warning also occurs with version 4.3.0, which works fine. Also, the log that Gouttfi uploaded doesn’t share this warning.
Node.js could not be automatically detected, has to be configured manually in the SonarLint preferences!
This warning did not occur with version 4.3.0, but I think this just means that JS and related language analyzers won’t work. These aren’t languages I work with. Also, the log that Gouttfi uploaded doesn’t share this warning.
Thanks for all your reports, logs, and patience I am sharing the promised custom build with enhanced logging. If you would be so kind as to try it out and share the logs, it would help us a lot in preparing the bugfix release, as we still cannot reproduce the issue on our side.
HERE you will find the build for all available platforms. For even more enhanced logs, you can add the following line to your VSCode User Settings - "sonarlint.trace.server": "verbose". But don’t forget to remove it after collecting the logs, as it is really really verbose option
Thanks in advance for your help
All the best,
Sophio
The issue is still present for me with version 4.4.2+76186, although I believe that was expected.
I set "sonarlint.trace.server": "verbose" and the output is much more verbose, but there’s still nothing that jumps out to me as an indication of the issue. Excluding the server trace messages, the pattern of messages appears to be the same as it was with version 4.4.1.
Is there a way I can securely share the log file? The server trace messages include a lot of information, more than I’d like to have to review for sensitive information to redact.
I am using Windows 11 and working with JS. However, I also tried creating a .java file in my project and I see the same issue, so it does not seem to be related to the programming language.
Regarding the logs, is it enough to add "sonarlint.trace.server": "verbose" to my settings, or do I need to download the custom build?
Regarding the logs, is it enough to add "sonarlint.trace.server": "verbose" to my settings, or do I need to download the custom build?
Since you are in standalone mode (not connected), there is no need for the custom build. You can just follow the instructions here to enable verbose logging, and then also add the "sonarlint.trace.server": "verbose" to your User settings.