LLVM Discussion Forums

Clangd Hot-Update Compilation database

Clangd depends on compilation database/commands that in most cases is generated by build system generators like CMake.
but the build system listings are a part of project and may change very frequently in Just-created projects that are in heavy develop.

in such a condition, some editors like VSCode must reload to take this changes in account and this is annoying…

Yes unfortunately this is a known limitation we’ve been wanting to work on for a while now. There are also
https://github.com/clangd/clangd/issues/83 and https://github.com/clangd/clangd/issues/192 as related issues.

We are planning to work on watching for changed files this quarter, at least to rebuild diagnostics on source files whenever you change headers those source files depend on. So at least there will be some infrastructure ready for basing this on top of and make this easier to solve.

I imagined a custom protocol message that tells to server that: Hey, Compilation situation has changed! reload the compilation DB again…

there’s already a notification in lsp protocol for reporting file changes, https://microsoft.github.io/language-server-protocol/specification#workspace_didChangeWatchedFiles so this doesn’t need to be an extension.

I really hate VSCode C/C++ extension. it is so slow. but reacts very good.
beside to this, i’m a fanatic of clang/llvm.

I Hope clangd replace this extension completely…