[PATCH] D49267: [clangd] Watch for changes in compile_commands.json

Ilya Biryukov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 23 01:08:05 PDT 2018


ilya-biryukov added a comment.
Herald added a subscriber: arphaman.

Thanks for putting up this change! It can be really annoying that clangd does not pick up the compile commands that got updated.

A few things of the top of my head on why we might want to punt on using the LSP watches:

- File watching may not be implemented in the language server at all. That's certainly the case for our hacked-up ycmd<->lsp bridge.
- At some point we'll be interested in changes to the headers our sources have included. This would involve a **lot** of watches for a dynamically changing set of files. There's a good chance we'll have to consider using native file watch APIs instead of the LSP methods to handle those (e.g., for performance reasons).

We've been talking about starting to implement a better buildsystem integration lately and taking compile_commands.json changes into account is certainly on the table. We'll probably have some concrete proposals in August/September.

In the meanwhile, maybe removing the caching of compile commands could fix the problem? I don't have any data on how important the caching is to performance (I would assume it to not be very important, since we only request compile commands on the file changes; completion, findDefinitions, etc reuse the last compile command anyway). 
https://reviews.llvm.org/D48071 added an option to disable the caching, it never landed because we didn't agree on the default, but we can make it happen.
It looks like a simpler workaround that works on all clients and we can figure out how to properly integrate file watching later. WDYT?


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D49267





More information about the cfe-commits mailing list