Skip to content

Instantly share code, notes, and snippets.

@james2doyle
Last active July 15, 2022 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save james2doyle/26b9877637bb896107f8f7b97683dc1b to your computer and use it in GitHub Desktop.
Save james2doyle/26b9877637bb896107f8f7b97683dc1b to your computer and use it in GitHub Desktop.
A .clangd file for clangd language server protocol that works with Arduino .ino files. Requires platformio and Arduino app to be installed. Also assumes leonardo board but you can change that in the list of variants
// need to add the following to define the Serial class:
// #if defined(DEVELOP)
// extern HardwareSerial Serial;
// #endif
CompileFlags:
Add: [-xc++, -Wall, -DDEVELOP=1, -I$HOME/.platformio/packages/toolchain-atmelavr/avr/include/, -I$HOME/.platformio/packages/framework-arduino-avr/cores/arduino/, -I/Applications/Arduino.app/Contents/Java/hardware/tools/avr/lib/gcc/avr/7.3.0/include/, -I/Applications/Arduino.app/Contents/Java/hardware/tools/avr/avr/include/avr/, -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/, -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/cores/arduino/, -I/Applications/Arduino.app/Contents/Java/hardware/tools/avr/include/libiberty/, -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/standard/, -I/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/variants/leonardo/, -I$HOME/.platformio/packages/toolchain-atmelavr/avr/include/avr/, -I$HOME/.platformio/packages/framework-arduino-avr/libraries/SoftwareSerial/src/, -I$HOME/.platformio/packages/framework-arduino-avr/firmwares/atmegaxxu2/arduino-usbserial/, -include HardwareSerial.h, -include Arduino.h]
Remove: -W* # strip all other warning-related flags
Compiler: clang++ # Change argv[0] of compile flags to `clang++`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment