Skip to content

Commit

Permalink
Auto merge of rust-lang#12093 - nico-abram:uwu, r=Veykril
Browse files Browse the repository at this point in the history
Reload project on .cargo/config[.toml] changes

Fixes rust-lang#11024

Not adding tests as discussed in the issue
  • Loading branch information
bors committed May 2, 2022
2 parents cc12d9d + b373e62 commit 9e10d4b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion crates/rust-analyzer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions crates/rust-analyzer/src/reload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
2 changes: 1 addition & 1 deletion docs/user/generated_config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`)::
+
Expand Down
2 changes: 1 addition & 1 deletion editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit 9e10d4b

Please sign in to comment.