But it does not work.
Am I doing something wrong? Or does it need to be enabled by sonarlint, similarly to how ${workspaceFolder} needed to be explicitely supported?
See How to set a relative path in vscode?
Thanks for reaching out.
It is currently not possible to define a custom variable in the pathToCompileCommands apart from the ${workspaceFolder} one.
Could you elaborate on why pointing the cmake build directory would help you? And why not use the ${workspaceFoler}?
When using a CMake project, the compile_commands.json is generally located at the root of the build directory.
So basically for all cmake projects "sonarlint.pathToCompileCommands": "${config:cmake.buildDirectory}/compile_commands.json" is always correct.
Also CMake projects are generally not built at the root of the source directory. Generally we have paths like these ones for the root of the build directory:
Thanks for your explanation. Your point is completely valid.
I will store your insight in our backlog to keep track of and monitor the traction. Note that this improvement will not be tackled in the short-term since we have other priorities.