After dozens of language server crashes, compilation errors and a lot of other problems, I made a small datastructure in #cpp using modules, which actually compiles AND can be parsed by #clangd without segfaulting a single time. Oh my gosch

#clangd is has issues when module import is in a header file, and not the cpp file. This is not a problem for clang, its all in the same translation unit. AFAICT this is legal and fine C++20 module code, clangd shouldn't have this issue.

https://github.com/llvm/llvm-project/issues/181770

#cpp #cplusplus #cppmodules #llvm #programming

[clangd] import from #include not working 路 Issue #181770 路 llvm/llvm-project

Code which is valid for C++20 modules being built by clang is not working for clangd. If an import is done within a header that gets #include'ed its as if the import didn't happen for that translat...

GitHub

Other projects I use every day:
#Matrix spec & clients like #FluffyChat and #nheko
#Bitwarden & #Vaultwarden password manager
#Neovim text editor
#clangd LSP

I'd love to encourage these projects to jump ship, and I celebrate those that do. I am much more likely to provide quality contributions if you host on your own forge, or a free one, and I am sure I'm not alone in this.

GitHub is hostile to FOSS and, despite giving away lots of free-of-cost stuff I believe ultimately hurts us.

Random pro-tip: if you want use clangd on project, make sure it builds with clang when generating the compile-commands.json file.

But sometimes the projects don't build with clang (I was recently looking at ipxe), and working with gcc build commands might be enough, at least on x86_64.
But on arm64, a specific flags was passed, -mabi=lp64. You can configure clangd to skip those flags on a per-project basis:
https://github.com/clangd/clangd/issues/734#issuecomment-814978138

#clangd #arm64

Couldn't build compiler instance 路 Issue #734 路 clangd/clangd

I use bear command to generate compile_commands.json file. And use clangd as spacemacs lsp backend. In my linuxkernel_5.0 project, I encounter errors below. LSP :: Error from the Language Server: i...

GitHub
I was fighting with #lsp-mode in #emacs to get it to use my system #clangd and failed. But I discovered #eglot-mode which picked it up fine and I much prefer the #ui choices they have made. How long has it been in core Emacs?

With clangd as an lsp how do you deal with any but the simplest build systems?

For instance, in MicroPython there are 24 "ports" and most of them have multiple "boards" or "variants". Altogether there are 200+ boards and variants put together.

There are probably a half dozen different compilers used for different CPU architectures, different builds have radically different compiler flags, and some files are included in all 200+ of those builds.

Oh and did I mention that some use make and some use cmake? (besides the ones that use west, but I am gonna just choose not to care about those right now)

I know how to pick ONE make-based build and make a complier_commands.json for it using bear, but it's going to only give me a tiny sliver of the whole picture.

Yes, one encounters the same problems when trying to validate changes via compiling, but since I'm new to language servers and clangd in particular I feel like I should ask.

(If it makes a difference I'm using neovim 0.11.3)

#lsp #languageServer #clang #clangd #askFedi

#TIL #clangd (the #LSP) doesn't seem to find system libraries if the path is not explicitly added to #clang (the compiler).

So here I am unnecessarily sprinkling `-I/usr/local/include` everywhere.

So... apparently the compile_commands.json generated by #clang with `-MJ compile_commands.json` has invalid syntax so #clangd fails (silently) to load it.
And even after fixing it manually I get a lot of "Unknown argument" errors.
I'm not even working on a big project. This is just a single .cpp file. Not even a header.
It's all tools from the #LLVM project. I'm not doing anything fancy!
This is so frustrating. 馃が

@pythno #clangd is a LSP for c language and c++. So, if you don't install clangd it'll not work.

#neovim

@pythno Try ...
1. Install #clangd but don't setup LSP. This will disable auto completions.
2. Use #codelldb for debugging -> https://igorlfs.github.io/neovim-cpp-dbg

#neovim

Building and Debugging C++ in Neovim