Open recursivenomad opened 5 months ago
I am in the same situation as you, where my compile_commands.json is located variously across different projects.
But I solved this by simply adding configuration in Settings->Workspace->clangd->Arguments, for example, --compile-commands-dir=${workspaceFolder}/build
in your discussion. 'Workspace' means the setting is for only current projects you are in and can be differently set in projects.
Hope this is useful for you.
The directory that my compile_commands.json is located in varies per-project, and I would like to be able to set
--compile-commands-dir
in a per-project VSCodesettings.json
. The location of compilers varies per-user, and I am currently using the global"clangd.arguments"
setting to define the location of my compilers with--query-driver
. You cannot have"clangd.arguments"
in your project and global settings, as the project settings will override the global settings, thus getting rid of the--query-driver
arguments.To solve this, it would be very helpful if I could define
--compile-commands-dir
with a separatesettings.json
entry, therefore enabling us to set the location of compile_commands.json per-project.Technically, I think it would make sense to append this argument specifically after
"clangd.arguments"
, so that if--compile-commands-dir
is already declared in"clangd.arguments"
, then the project-level--compile-command-dir
is supplied last and therefore would be the one clangd uses.For additional context, please see this discussion in the clangd language server repository.