Operating system: Windows 11 with WSL2 running Ubuntu 22.04
SonarLint plugin version: v3.20.2
Programming language you’re coding in: C++
Is connected mode used: No
I just installed the SonarLint extension but it keeps popping up this message “SonarLint is unable to analyze C and C++ file(s) beause there is no configured compilation database”. When I click on “Configure compile commands” nothing happens.
After clicking the “Configure compile commands” button something definitely should happen.
It may be a quick pick list if there are more than one compile_commands.json file in the project.
Also it maybe a warning notification if there is no compile_commands.json file found.
The least obvious may be the case when you have exactly one compile_commands.json file in your project. Then you will get the notification that the database is configured and your project/.vscode/settings.json will be modified.
So first please can you check your settings.json. If there is a property sonarlint.pathToCompileCommands?
It should look similar to this: "sonarlint.pathToCompileCommands": "${workspaceFolder}/cmake-build-debug/compile_commands.json"
If there is no such property, then I ask you to enable verbose logging, trigger the compilation database setup, and upload the SonarLint output here. To manually trigger the compilation database setup you can invoke the command called “Configure the compilation database for C and C++ analysis” using the command palette of VSCode.
This was before I set anything up, I don’t think I was even generating a compile_commands.json file yet. I’ve now setup my build so the dialog isn’t appearing. If I see the problem again I’ll grab the log.