Reload project on .cargo/config[.toml] changes

Fixes #11024
This commit is contained in:
unknown 2022-04-26 19:02:45 -03:00
parent 198c075580
commit b373e62f1a
4 changed files with 8 additions and 3 deletions

View file

@ -67,7 +67,7 @@ config_data! {
callInfo_full: bool = "true",
/// Automatically refresh project info via `cargo metadata` on
/// `Cargo.toml` changes.
/// `Cargo.toml` or `.cargo/config.toml` changes.
cargo_autoreload: bool = "true",
/// Activate all available features (`--all-features`).
cargo_allFeatures: bool = "false",

View file

@ -617,6 +617,11 @@ pub(crate) fn should_refresh_for_change(path: &AbsPath, change_kind: ChangeKind)
return false;
}
if path.extension().unwrap_or_default() != "rs" {
if (file_name == "config.toml" || file_name == "config")
&& path.parent().map(|parent| parent.as_ref().ends_with(".cargo")) == Some(true)
{
return true;
}
return false;
}
if IMPLICIT_TARGET_FILES.iter().any(|it| path.as_ref().ends_with(it)) {

View file

@ -42,7 +42,7 @@ Show function name and docs in parameter hints.
+
--
Automatically refresh project info via `cargo metadata` on
`Cargo.toml` changes.
`Cargo.toml` or `.cargo/config.toml` changes.
--
[[rust-analyzer.cargo.allFeatures]]rust-analyzer.cargo.allFeatures (default: `false`)::
+

View file

@ -439,7 +439,7 @@
"type": "boolean"
},
"rust-analyzer.cargo.autoreload": {
"markdownDescription": "Automatically refresh project info via `cargo metadata` on\n`Cargo.toml` changes.",
"markdownDescription": "Automatically refresh project info via `cargo metadata` on\n`Cargo.toml` or `.cargo/config.toml` changes.",
"default": true,
"type": "boolean"
},