Skip to content

Commit b373e62

Browse files
committed
Reload project on .cargo/config[.toml] changes
Fixes rust-lang#11024
1 parent 198c075 commit b373e62

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ config_data! {
6767
callInfo_full: bool = "true",
6868

6969
/// Automatically refresh project info via `cargo metadata` on
70-
/// `Cargo.toml` changes.
70+
/// `Cargo.toml` or `.cargo/config.toml` changes.
7171
cargo_autoreload: bool = "true",
7272
/// Activate all available features (`--all-features`).
7373
cargo_allFeatures: bool = "false",

crates/rust-analyzer/src/reload.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,11 @@ pub(crate) fn should_refresh_for_change(path: &AbsPath, change_kind: ChangeKind)
617617
return false;
618618
}
619619
if path.extension().unwrap_or_default() != "rs" {
620+
if (file_name == "config.toml" || file_name == "config")
621+
&& path.parent().map(|parent| parent.as_ref().ends_with(".cargo")) == Some(true)
622+
{
623+
return true;
624+
}
620625
return false;
621626
}
622627
if IMPLICIT_TARGET_FILES.iter().any(|it| path.as_ref().ends_with(it)) {

docs/user/generated_config.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ Show function name and docs in parameter hints.
4242
+
4343
--
4444
Automatically refresh project info via `cargo metadata` on
45-
`Cargo.toml` changes.
45+
`Cargo.toml` or `.cargo/config.toml` changes.
4646
--
4747
[[rust-analyzer.cargo.allFeatures]]rust-analyzer.cargo.allFeatures (default: `false`)::
4848
+

editors/code/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@
439439
"type": "boolean"
440440
},
441441
"rust-analyzer.cargo.autoreload": {
442-
"markdownDescription": "Automatically refresh project info via `cargo metadata` on\n`Cargo.toml` changes.",
442+
"markdownDescription": "Automatically refresh project info via `cargo metadata` on\n`Cargo.toml` or `.cargo/config.toml` changes.",
443443
"default": true,
444444
"type": "boolean"
445445
},

0 commit comments

Comments
 (0)