mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Auto merge of #17949 - Wilfred:include_build_file_in_watchers, r=lnicola
fix: rust-analyzer should watch build files from rust-project.json rust-analyzer always watches Cargo.toml for changes, but other build systems using rust-project.json have their own build files. Ensure we also watch those for changes, so we know when to reconfigure rust-analyzer when dependencies change.
This commit is contained in:
commit
74a6427861
@ -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)))
|
||||
|
Loading…
x
Reference in New Issue
Block a user