Skip to content

Commit 88662e1

Browse files
authored
Merge pull request #21969 from BenjaminBrienen/reload
changes to build scripts and config.toml should always refresh
2 parents 76ce53a + 1e0853e commit 88662e1

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

crates/rust-analyzer/src/reload.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,7 @@ pub(crate) fn should_refresh_for_change(
977977
change_kind: ChangeKind,
978978
additional_paths: &[&str],
979979
) -> bool {
980+
// Note: build scripts are retriggered on file save, no refresh is necessary
980981
const IMPLICIT_TARGET_FILES: &[&str] = &["build.rs", "src/main.rs", "src/lib.rs"];
981982
const IMPLICIT_TARGET_DIRS: &[&str] = &["src/bin", "examples", "tests", "benches"];
982983

@@ -993,15 +994,20 @@ pub(crate) fn should_refresh_for_change(
993994
return true;
994995
}
995996

997+
// .cargo/config{.toml}
998+
if matches!(file_name, "config.toml" | "config")
999+
&& path.parent().map(|parent| parent.as_str().ends_with(".cargo")).unwrap_or(false)
1000+
{
1001+
return true;
1002+
}
1003+
1004+
// Everything below only matters when files are created or deleted
9961005
if change_kind == ChangeKind::Modify {
9971006
return false;
9981007
}
9991008

1000-
// .cargo/config{.toml}
10011009
if path.extension().unwrap_or_default() != "rs" {
1002-
let is_cargo_config = matches!(file_name, "config.toml" | "config")
1003-
&& path.parent().map(|parent| parent.as_str().ends_with(".cargo")).unwrap_or(false);
1004-
return is_cargo_config;
1010+
return false;
10051011
}
10061012

10071013
if IMPLICIT_TARGET_FILES.iter().any(|it| path.as_str().ends_with(it)) {

0 commit comments

Comments
 (0)