================
@@ -942,8 +947,13 @@ void ClangdServer::outgoingCalls(
 }
 
 void ClangdServer::onFileEvent(const DidChangeWatchedFilesParams &Params) {
-  // FIXME: Do nothing for now. This will be used for indexing and potentially
-  // invalidating other caches.
+  if (!ModulesManager)
+    return;
+  bool ModulesChanged = false;
+  for (const auto &Change : Params.changes)
+    ModulesChanged |= ModulesManager->onFileEvent(Change);
+  if (ModulesChanged)
+    reparseOpenFilesIfNeeded([](PathRef) { return true; });
----------------
berkaysahiin wrote:

This routes the `workspace/didChangeWatchedFiles` events clangd already 
receives into the module system, so newly created/changed/deleted module files 
are picked up without waiting for compile_commands.json to be regenerated.

This patch only connects it to ModulesBuilder::onFileEvent.

There are two ways a module file is discovered:
- observeSourcePath, called when a file is opened in the editor, no watcher 
needed.
- onFileEvent, for create/change/delete on disk.

https://github.com/llvm/llvm-project/pull/218958
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to