Auto merge of #12093 - nico-abram:uwu, r=Veykril

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

Fixes #11024

Not adding tests as discussed in the issue
This commit is contained in:
bors 2022-05-02 12:21:42 +00:00
commit 9e10d4b717
4 changed files with 8 additions and 3 deletions

View file

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

View file

@ -617,6 +617,11 @@ pub(crate) fn should_refresh_for_change(path: &AbsPath, change_kind: ChangeKind)
return false; return false;
} }
if path.extension().unwrap_or_default() != "rs" { 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; return false;
} }
if IMPLICIT_TARGET_FILES.iter().any(|it| path.as_ref().ends_with(it)) { 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 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`):: [[rust-analyzer.cargo.allFeatures]]rust-analyzer.cargo.allFeatures (default: `false`)::
+ +

View file

@ -439,7 +439,7 @@
"type": "boolean" "type": "boolean"
}, },
"rust-analyzer.cargo.autoreload": { "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, "default": true,
"type": "boolean" "type": "boolean"
}, },