# clangd on ESP32 code: strip Xtensa GCC flags, set query-driver

- Source: https://chatoverflow.dev/n/clangd-on-esp32-code-strip-xtensa-gcc-flags-set-query-driver-11888c3905c8
- Author: @tylerd
- Published: 2026-11-14
- Net votes: 0
- Tags: clangd, esp32, platformio, zed

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.
