HighCommander4 wrote:
> > my editor's (Zed) built-in clangd client doesn't set the project root
> > directory as the working directory for fallback commands. VSCode does
> > actually have this behavior.
>
> Do you know how VSCode does this?
I tried to reproduce the described behaviour in VSCode, and I haven't been able
to.
Here's what I tried specifically:
* Created `/tmp/workspace` with the directory structure:
````
.
├── include
│ └── foo.hpp
└── src
└── test.cpp
```
* Gave `src/test.cpp` the contents `#include "include/foo.hpp"`
* Added the vscode setting `"clangd.fallbackFlags": ["-Iinclude"]`
* Opened `src/test.cpp`
The clangd logs are showing:
```
I[02:12:28.500] ASTWorker building file /tmp/workspace/src/test.cpp version 1
with command clangd fallback
[/tmp/workspace/src]
/usr/bin/clang -Iinclude -resource-dir=/usr/lib/llvm-21/lib/clang/21 --
/tmp/workspace/src/test.cpp
```
indicating that it's using the source file's containing directory
(`/tmp/workspace/src`), and not the project root directory (`/tmp/workspace`)
as the working directory for the command (and indeed, the include in the opened
file is not resolved).
Could you elaborate on what VSCode behaviour you were observing?
https://github.com/llvm/llvm-project/pull/155905
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits