ayamir / nvimdots

A well configured and structured Neovim.
BSD 3-Clause "New" or "Revised" License
2.83k stars 451 forks source link

How can I modify the `clangd.lua` to make it support C++ 20? #1144

Closed shaojunjie0912 closed 5 months ago

shaojunjie0912 commented 6 months ago

Hi, I have some problems with modifying the clangd.lua to make it support C++ 20.

Snipaste_2024-01-10_16-03-25

How can I modify this?

Jint-lzxy commented 6 months ago

afaik clangd doesn't support setting driver options thru command line options atm. But u can create a user or project config (see clangd:Configuration#files) and fill in the following content to make it work:

CompileFlags:
  Add: [-std=c++20] # or -std=gnu++20

Do note that support for c++20 by many open-source LSP vendors, including clangd, is still in the alpha stage, and many features that require compiler support have not (yet) been implemented. You may encounter a bunch of errors and it's expected, see my reply here.

shaojunjie0912 commented 6 months ago

Thank you! @Jint-lzxy I will have a try.

shaojunjie0912 commented 5 months ago

It works! Thanks a lot.