Support "variables scoped per workspace folder" (e.g. `${workspaceFolder:Project1}`) in config values
Please describe the problem. For hints on what information is helpful, see: https://clangd.llvm.org/troubleshooting.html
If you can, provide a minimal chunk of code that shows the problem (either inline, or attach it if larger).
settings:
"clangd.trace": "~/clangd.log",
"clangd.path": "${workspaceFolder:cpp-project}/clangd.sh"
It will report cannot find '/path/to/workspace/${workspaceFolder:cpp-project}/clangd.sh' cannot be found. Log file is also missing.
Logs related log:
Error while opening trace file ~/clangd.log: No such file or directory
System information
Clangd version (from the log, or clangd --version):
clangd extension version: clangd version 18.1.3
Operating system: AlmaLinux 9.4 (Seafoam Ocelot)
${workspaceFolder} should work, its substitution is implemented here.
~ is not supported but looking further up in the same function, ${userHome} should work as an alternative.
Hmm, but at least it doesn't expand the workspacefolder in my example when I put it in clangd.path
Hmm, but at least it doesn't expand the workspacefolder in my example when I put it in clangd.path
I can't reproduce this, it seems to be expanded fine for me.
Can you provide some more details?
- vscode-clangd version
- vscode version
- path to the file containing the
"clangd.path"setting - contents of the file contianing the
"clangd.path"setting - contents of
clangd.sh(assuming it's a script)
- vscode-clangd v0.1.29
- vscode Version: 1.94.2 Commit: 384ff7382de624fb94dbaf6da11977bba1ecd427 Date: 2024-10-09T16:08:44.566Z Electron: 30.5.1 ElectronBuildId: 10262041 Chromium: 124.0.6367.243 Node.js: 20.16.0 V8: 12.4.254.20-electron.0 OS: Linux x64 6.8.0-47-generic
Hmm, but at least it doesn't expand the workspacefolder in my example when I put it in clangd.path
I can't reproduce this, it seems to be expanded fine for me.
Sorry, since I modify the settings too many times for testing, I actually mixed up things.
${workspaceFolder} works fine, but the Variables scoped per workspace folder ${workspaceFolder:<one of the workspace root folder name>} does not work.
I have to use ${workspaceFolder:cpp-project} to identify the path, since clangd only starts in the root1.
{
"folders": [
{
"name": "non-cpp-project",
"path": "../root1"
},
{
"name": "cpp-project",
"path": "../root2"
}
],
"settings": {
"python.defaultInterpreterPath": "${workspaceFolder}/venv/bin/python",
"cmake.cmakePath": "${workspaceFolder}/cmake.sh",
"cmake.configureArgs": [
"--fresh"
],
"cmake.useCMakePresets": "always",
"clangd.arguments": [
"--log=verbose",
"--suggest-missing-includes",
"--pretty"
]
}
}
${workspaceFolder}works fine, but the Variables scoped per workspace folder${workspaceFolder:<one of the workspace root folder name>}does not work.
Thanks. I revised the issue title to be about this latter case.