Open matthewsanetra opened 3 months ago
I am not expert in clangd. But doesn't clangd always see files as C++.
I think change language in the editor is doesn't changing the fact that both C and C++ in Zed are using clangd, so clangd would show diagnostic according to clangd config.
As for way to configure clangd. One of the recommended way to config clangd that doesn't involve CMake is to use .clangd
.
I suggest you take a look at clangd's configuration page.
https://clangd.llvm.org/config
I am not expert in clangd. But doesn't clangd always see files as C++.
It seems so, but there's a way to configure it differently, mentioned in
https://github.com/zed-industries/zed/issues/14411#issuecomment-2227324916
Check for existing issues
Describe the bug / provide steps to reproduce it
clangd is not informed of the language currently selected in the editor.
This means that in header files, clangd assumes C++.
A workaround I currently use is to just use CMake and export a compile_commands.json into the project root. This passes the info that we're compiling C to clangd so it works, but I believe the editor shouldn't require us to use CMake to code in C comfortably.
Environment
Zed: v0.137.6 (Zed) OS: macOS 14.4.1 Memory: 16 GiB Architecture: aarch64
If applicable, add mockups / screenshots to help explain present your vision of the feature
C language is selected:
Error in a header file:
If applicable, attach your
~/Library/Logs/Zed/Zed.log
file to this issue.No response