ZachMassia / PlatformIO-Mode

PlatformIO Integration for Emacs
GNU General Public License v3.0
67 stars 20 forks source link

Eglot #21

Open Spidy104 opened 2 years ago

Spidy104 commented 2 years ago

I use clangd as my auto completion engine, how do we integrate it or is there not any support at all and how do we install and use new libraries?

fernandodemorais-jf commented 1 year ago

Hello @Spidy104,

The maintainers can be more specific, but I think PlatformIO supports only clang-tidy.

I use clangd with Eglot too, and I simply manually "convert" the .ccls file, auto-generated by compilation process, to a .clangd one.

A line like the following in a .ccls file:

%c -std=gnu11 -fno-fat-lto-objects -Os -Wall -ffunction-sections -fdata-sections -flto -mmcu=atmega328p

Would become, in the .clangd one:

---                             # Compiler arguments when parsing C files
If:
  PathMatch: .*\.c
CompileFlags:
  Add: [-std=gnu11, -fno-fat-lto-objects, -Os, -Wall, -ffunction-sections, -fdata-sections, -flto, -mmcu=atmega328p]

You can find more info about those parameters in https://clangd.llvm.org/config.

I believe that an "auto-converter" would be a great addition to the code, besides not seeming too complex to implement.