How to set a relative path in vscode?

Hello,

I’m using Debian Linux with Mate 1.16.2
VSCode 1.64.2, with SonarLint extension 3.4.0
to programm in C++
and I’m happy you just added the C++ support for VSCode - thank you

I have a multiroot Workspace with differnet folders for different git based projects and want to set “sonarlint.pathToCompileCommands” in the folder settings,
It works fine with an absolut path, but I need a relative path since the project root is located on different locations by different users.
The absolut path is (on my machine)
/home/pf/projects/lbfb_3g_gw_common_libs/dev/build/armhf/compile_commands.json
I tried ${workspaceFolder}/dev/build/armhf/compile_commands.json and
dev/build/armhf/compile_commands.json
but this didn’t work, SonarLint didn’t find compile_commands.json.

How can I set a relative path to compile_commands.json?

Regards
Klaus

1 Like

Hi @kkleiner

We are not supporting the placeholder ${workspaceFolder} at the moment. A relative path would be very brittle since we would have to agree on what is the basedir.

I have created a ticket to support the ${workspaceFolder} placeholder:
https://jira.sonarsource.com/browse/SLVSCODE-272

We will probably implement that in the next sprint.

Thanks for the feedback!

1 Like

FYI: Left is working, right is not. See message box on bottom.

It will be supported in version 3.5 (not yet released).

2 Likes

I have a new similar requirement for this:

sonarlint should evalualte commands of the ms-vscode.cmake-tools plugin. This way we can use different setups (Debug/Release etc). See here:

@Julien_HENRY Can you also create a jira issue for this?

Note: We use the cmake presets mode, not the cmake kits mode.

Hello @KUGA2,

I believe the post above corresponds to this other thread you recently opened, so I will answer on the other one. If it’s not the case, could you please elaborate on the difference ?

Thanks

You are correct. I opened a new one because there was no answer here in more then one week so I thought you do not read “resolved” threads.

1 Like