vscode-clangd icon indicating copy to clipboard operation
vscode-clangd copied to clipboard

File watcher is not activated: clangd does not refresh open files on compile_commands.json changes

Open WB2210 opened this issue 1 year ago • 4 comments

Not sure if to tag as bug or enhancement -

Open files do not refresh in vscode when compile_commands.json changes, unless the each file is manually closed and re-opened or remembering to run restart clangd server command (Which 99% of the time I forget to do after updating compile_commands.json), this causes confusion when switching targets that have different ifdefs and defines.

I see that clangd extension supports file watch, I tried to debug the extension and discovered that the file watch is never called, when I manually edited the code to force call it, when compile_commands.json changes language server restarts and the files in vscode are refreshed properly, without having to manually perform refresh clangd or close and open each file every time a target is switched.

So what's the solution? Can we have the file watch enabled back? (It fixes the issue) Are all opened files supposed to refresh automatically on vscode without restarting the server? Thanks

System information Clangd version (from the log, or clangd --version): 18.1.3 (tried on version 16 too, same issue) clangd extension version: 1.29 Operating system: mac

WB2210 avatar Sep 10 '24 21:09 WB2210

I think this is a duplicate of #300, with this comment describing the current state of things.

HighCommander4 avatar Sep 10 '24 22:09 HighCommander4

Hmmm so from my understanding this issue is still unresolved Why not simply re-enable the file watch config? It doesn't harm to enable it back the way it was (which was optional anyways) and it would fix the issue (at least for me and for most people who have this problem I suppose)

Thanks

WB2210 avatar Sep 10 '24 22:09 WB2210

Could you specify what config / code change you're referring to?

(And could you please do it in a comment on #300, to keep the discussion in one place? Thanks!)

HighCommander4 avatar Sep 10 '24 22:09 HighCommander4

Moving to #300

WB2210 avatar Sep 11 '24 06:09 WB2210