vscode-clangd
vscode-clangd copied to clipboard
[Feature request]Request support for clangd's folder settings configuration in multi-root workspace
Hello,
The clangd configuration of the 'folder settings' is unavailable in multi-root workspace
As the screenshot shows, clangd configuration is grey unavailable, there will be this prompt "This setting cannot be applied in this workspace. It will be applied when you open the containing workspace folder directly."
My current scenario is that the workspace has two separate projects (different toolchains) requiring different changd configurations. Refering to the cpptools extension of Microsoft, folder settings can take effect in the case of multi-root workspace. However, according to the log, clangd always uses the workspace setting(*.code-workspace).
Loading the compile_commands.json file in the directory where the *.code-workspace file resides causes the clangd extension's intellisaware functionality to be incorrect.
The expected result is to be able to load the compile_commands.json file in each Root folder of multi-root workspace.
The directory structure for the test is as follows, TestRootFolder1: . ├── .clang-format ├── workspace.code-workspace ├── .vscode │ ├── settings.json │ └── compile_commands.json ├── bin ├── include ├── lib ├── Makefile ├── src └── tests
TestRootFolder2: . ├── .clang-format ├── .vscode │ ├── settings.json │ └── compile_commands.json ├── bin ├── include ├── lib ├── Makefile ├── src └── tests
在TestRootFolder1文件夹中和TestRootFolder2文件夹中增加.clangd 内容输入
CompileFlags:
CompilationDatabase: your path
Problem is that "$(workspaceFolder}" is not parsed and substituted prior to passing the string in "--compile-commands-dir=".
Problem is that "$(workspaceFolder}" is not parsed and substituted prior to passing the string in "--compile-commands-dir=".
It should be, we have support for doing that.
Currently, I have workspace 1, which contains four independent projects A,B,C and D. There is workspace 2, which contains four independent projects M,B,C and N, in which project B and C are shared dependencies of the two workspace. In addition, the two workspace cross-compile environments are different. It would be troublesome to configure the.clangd file
CompileFlags:
CompilationDatabase: your path
on project B and C. If we can use vscode workspace configuration to set "clangd.arguments": ["--compile-commands-dir=$(workspaceFolder)/Path"] and is automatically applied to every multi-root workspace root folder is a good solution to this problem.
"clangd.arguments": ["--compile-commands-dir=$(workspaceFolder)/Path"] 'only works for the directory where file *.code-workspace is located.