about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWilfred Hughes <wilfred@meta.com>2024-08-23 15:10:01 -0700
committerWilfred Hughes <wilfred@meta.com>2024-08-23 17:49:03 -0700
commitbdbc057becb15199813051e623b786f57a1d7466 (patch)
tree8ae25d3eecd351b9ed8be677f3684558405048a7
parent3bd42d3c4d9b97f2ef26d27ea8dd5aa6d52bcb16 (diff)
downloadrust-bdbc057becb15199813051e623b786f57a1d7466.tar.gz
rust-bdbc057becb15199813051e623b786f57a1d7466.zip
Include buildfile path in watcher list
-rw-r--r--src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs
index 5d0c6b65992..8a28de10e82 100644
--- a/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs
+++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs
@@ -564,6 +564,23 @@ impl GlobalState {
                         .collect()
                 };
 
+            // Also explicitly watch any build files configured in JSON project files.
+            for ws in self.workspaces.iter() {
+                if let ProjectWorkspaceKind::Json(project_json) = &ws.kind {
+                    for (_, krate) in project_json.crates() {
+                        let Some(build) = &krate.build else {
+                            continue;
+                        };
+                        watchers.push(lsp_types::FileSystemWatcher {
+                            glob_pattern: lsp_types::GlobPattern::String(
+                                build.build_file.to_string(),
+                            ),
+                            kind: None,
+                        });
+                    }
+                }
+            }
+
             watchers.extend(
                 iter::once(Config::user_config_path())
                     .chain(self.workspaces.iter().map(|ws| ws.manifest().map(ManifestPath::as_ref)))