From 5fffb0a4c98eda64f1430b8b2f4cbd57fa51d30b Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Thu, 23 May 2024 14:03:33 -0700 Subject: [PATCH] Watch for changes to source files We used to only watch for file creation and deletion because that might modify build settings but for background indexing, we also need to watch for changes to the files, so we can invalidate the up-to-date status of the target. --- Sources/SourceKitLSP/SourceKitLSPServer.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/SourceKitLSP/SourceKitLSPServer.swift b/Sources/SourceKitLSP/SourceKitLSPServer.swift index 644b3f093..99860cdb9 100644 --- a/Sources/SourceKitLSP/SourceKitLSPServer.swift +++ b/Sources/SourceKitLSP/SourceKitLSPServer.swift @@ -1470,7 +1470,7 @@ extension SourceKitLSPServer { // dynamic registration of watch patterns. // This must be a superset of the files that return true for SwiftPM's `Workspace.fileAffectsSwiftOrClangBuildSettings`. var watchers = FileRuleDescription.builtinRules.flatMap({ $0.fileTypes }).map { fileExtension in - return FileSystemWatcher(globPattern: "**/*.\(fileExtension)", kind: [.create, .delete]) + return FileSystemWatcher(globPattern: "**/*.\(fileExtension)", kind: [.create, .change, .delete]) } watchers.append(FileSystemWatcher(globPattern: "**/Package.swift", kind: [.change])) watchers.append(FileSystemWatcher(globPattern: "**/compile_commands.json", kind: [.create, .change, .delete]))