-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request]: Better support for clangd extenstion out of the box (VSC-1527) #1352
Comments
You can:
Then when you build your project, a compile_commands.json is generated which can be used for these extensions as described in https://docs.espressif.com/projects/vscode-esp-idf-extension/en/latest/configureproject.html#c-and-c-code-navigation-and-syntax-highlight |
Providing clangd extension with
|
The idea is to use one or the other not both extension at the same time. Also need to pass compile_commands.json to the extension to resolve such errors |
Ok so the question is why this results in errors:
I've got "Too many errors emitted" on one bigger project and "stdio.h not found" on another, very simple project. Edit: judging by the Eclipse plugin all three should be set: clangd path, --query-driver and --compile-commands-dir. Yet this still results in errors. |
The Clangd vscode extension will search for compile_commands.json in the Besides these tasks I'm not sure why the project is not picking up. Initially when you install the clang extension you need to download the clangd server in order for the extension to work. Since it is a third party extension we don't maintain it, but we can help if you can share an example project to reproduce your issue. |
So that is strange. I did initially install clangd server as recommended by extension, but later tried with clangd from IDF and results seemed better at first. But I tried swapping multiple times too. At this point even the workarounds not work anymore and any project is showing errors. It still builds and runs on HW without issues. I can share this for example: cert_test.zip I've packed it including build folder so you can see build logs too, just removed esp-idf subfolder to reduce size. |
Clangd still emits errors with this workaround. I installed clangd with: "clangd.path": "/home/user/esp-dev/esp32/tools/esp-clang/16.0.1-fe4f10a809/esp-clang/bin/clangd",
"clangd.arguments": ["--query-driver=/home/user/esp-dev/esp32/tools/xtensa-esp-elf/esp-13.2.0_20240530/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc"], |
This issue has been marked as |
Issue still present |
Is your feature request related to a problem? Please describe.
clangd extension does not recognize correct system headers
--query-driver=/home/user/.espressif/tools/xtensa-esp-elf/esp-14.2.0_20240906/xtensa-esp-elf/bin/xtensa-esp32-elf-gcc
.clangd extension only works correctly with clangd path set to espressif one
/home/user/.espressif/tools/esp-clang/esp-18.1.2_20240912/esp-clang/bin/clangd
Describe the solution you'd like
I would prefer to use clangd for code navigation over MS C/C++ extension. Main reason being that it supports Inactive code block background highlight. AFAIK this is at this point the only IDE option for Espressif devices that supports this feature.
As new user of ESP-IDF in VSCode and clang in general, it took me far too much time to find at least those workarounds so I could work on my project in a way I was used to.
There is
c_cpp_properties.json
file for MS C/C++ extension - I would expect something simillar could be done for clangd support too?Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: