Closed DYAAL closed 2 weeks ago
Clangd automatically loads a compile_commands.json
file when a source file in its directory tree is opened.
So, as long as you've opened both a file in A and a file in B, navigation across the two projects should work as expected.
Should I include two separate directories in the --compile-commands-dir property? For example, if I have both files in the 'build' directory under the current folder, do I need to set --compile-commands-dir=${workspaceFolder}/A/build and then set it again as --compile-commands-dir=${workspaceFolder}/B/build
I have generated two compile_commands.json files through compilation, located respectively in A/build and B/build relative to the current workspaceFolder. How can I configure clangd to load both of these compile_commands.json files simultaneously?
Should I include two separate directories in the --compile-commands-dir property? For example, if I have both files in the 'build' directory under the current folder, do I need to set --compile-commands-dir=${workspaceFolder}/A/build and then set it again as --compile-commands-dir=${workspaceFolder}/B/build
In this situation, you would not use the --compile-commands-dir
argument, as that only takes one directory and can only be specified once.
How can I configure clangd to load both of these compile_commands.json files simultaneously?
There isn't a way to do that currently. Clangd loads the CDB when a source file in the respective directory is opened.
Note that --compile-commands-dir
does not cause clangd to eagerly load the CDB, either; it still only happens when a source file is opened for the first time.
ok, thanks a lot for your help! Have a nice day.
Hello, sorry to bother you, I have a question. If my current working directory contains two folders, A and B, each with its own compile_commands.json file that needs to be parsed because A and B are two separate projects. After compiling, two compile_commands.json files are generated. I want to be able to parse them both simultaneously and use clangd to navigate between them.
How can I configure the --compile-commands-dir attribute of the clangd plugin in my current workspace to achieve this effect?