Hacker News new | ask | show | jobs
by lstodd 51 days ago
What's so special about clangd?

I only had to silence a couple of unneeded warnings specific to codebase I was working with, which took under five minutes and that only because I finally got annoyed enough. Otherwise it took zero configuration (this was Kate though, but it doesn't matter, there is no clangd-specific default config there).

1 comments

Basically that clangd needs an accurate compilation database to consume, which isn't a requirement for other language spaces.
What is an "accurate compilation database"?

If you mean that dependencies better resolve = project better be in a mostly buildable state or they complain of undefined stuff that's true.

The compilation database[1] given to clangd needs to be complete, understood by the clangd argument parser, and capable of producing a build.

This starts to hurt bad when the compiler producing the build is not clang. If you try to use a compile database describing C++20 module compile lines for GCC, clangd will choke badly. If you're using MSVC flags that clang-cl hasn't been taught yet, clangd falls over. If you're using CMake to produce the compile database, it will leave out synthetic targets from the database and you will see errors because clangd cannot find the interfaces described by those targets. If you're not using CMake you need to configure bear or ninja or whatever to produce a compilation database for you. Etc, etc.

[1]: https://clang.llvm.org/docs/JSONCompilationDatabase.html