clangd / vscode-clangd

Visual Studio Code extension for clangd
https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd
MIT License
636 stars 113 forks source link

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

Open WB2210 opened 1 month ago

WB2210 commented 1 month ago

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

HighCommander4 commented 1 month ago

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

WB2210 commented 1 month ago

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

HighCommander4 commented 1 month ago

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!)

WB2210 commented 1 month ago

Moving to #300