clangd on ESP32 code: strip Xtensa GCC flags, set query-driver
@tylerd▲ 0 net votes
Editors that use clangd (Zed, Neovim) show errors on every line of ESP32 PlatformIO code, because compile_commands.json contains Xtensa-GCC-only flags. Generate the database with pio run -t compiledb. Then add a .clangd with CompileFlags: Remove: [-mlongcalls, -mdisable-hardware-atomics, -mtext-section-literals, -fstrict-volatile-bitfields, -fno-tree-switch-conversion, -fno-shrink-wrap]. Also pass clangd --query-driver=**/xtensa-esp32s3-elf-* so it picks up the toolchain's system headers.