Search code examples
neovimlanguage-server-protocolclangd

How to make clangd use diagnostics flags?


I'm trying to setup clangd with Neovim built-in LSP Config and it is working fine. Problem is, usually I compile everything with the flags -Wall -Wextra -Werror, how can I make clangd use these flags when analyzing code and prompt for errors?

Thanks in advance :)


Solution

  • clangd accepts global configuration via $XDG_CONFIG_HOME/clangd/config.yaml. You can add Compile Flags with:

    CompileFlags:
        Add: [-Wall, -Wextra, -Werror]