Unnamed repository; edit this file 'description' to name the repository.
Apply changes, fix path information in a comment in config.rs
Ali Bektas 2024-08-31
parent 5e6f5b1 · commit b17f1ee
-rw-r--r--crates/rust-analyzer/src/config.rs8
-rw-r--r--crates/rust-analyzer/src/handlers/notification.rs13
-rw-r--r--crates/rust-analyzer/src/reload.rs2
3 files changed, 4 insertions, 19 deletions
diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs
index 0a1bdf49bd..c884216b3e 100644
--- a/crates/rust-analyzer/src/config.rs
+++ b/crates/rust-analyzer/src/config.rs
@@ -62,12 +62,10 @@ mod patch_old_style;
// To deprecate an option by replacing it with another name use `new_name | `old_name` so that we keep
// parsing the old name.
config_data! {
- /// Configs that apply on a workspace-wide scope. There are 3 levels on which a global configuration can be configured
- // FIXME: 1. and 3. should be split, some configs do not make sense per project
+ /// Configs that apply on a workspace-wide scope. There are 2 levels on which a global configuration can be configured
///
- /// 1. `rust-analyzer.toml` file under user's config directory (e.g ~/.config/rust-analyzer.toml)
+ /// 1. `rust-analyzer.toml` file under user's config directory (e.g ~/.config/rust-analyzer/rust-analyzer.toml)
/// 2. Client's own configurations (e.g `settings.json` on VS Code)
- /// 3. `rust-analyzer.toml` file located at the workspace root
///
/// A config is searched for by traversing a "config tree" in a bottom up fashion. It is chosen by the nearest first principle.
global: struct GlobalDefaultConfigData <- GlobalConfigInput -> {
@@ -532,7 +530,7 @@ config_data! {
cargo_allTargets: bool = true,
/// Automatically refresh project info via `cargo metadata` on
/// `Cargo.toml` or `.cargo/config.toml` changes.
- pub(crate) cargo_autoreload: bool = true,
+ cargo_autoreload: bool = true,
/// Run build scripts (`build.rs`) for more precise code analysis.
cargo_buildScripts_enable: bool = true,
/// Specifies the invocation strategy to use when running the build scripts command.
diff --git a/crates/rust-analyzer/src/handlers/notification.rs b/crates/rust-analyzer/src/handlers/notification.rs
index dc8d40e0ee..e8d1a7e4df 100644
--- a/crates/rust-analyzer/src/handlers/notification.rs
+++ b/crates/rust-analyzer/src/handlers/notification.rs
@@ -145,13 +145,10 @@ pub(crate) fn handle_did_save_text_document(
state: &mut GlobalState,
params: DidSaveTextDocumentParams,
) -> anyhow::Result<()> {
- let mut deps_change_processed = false;
-
if let Ok(vfs_path) = from_proto::vfs_path(&params.text_document.uri) {
let snap = state.snapshot();
let file_id = snap.vfs_path_to_file_id(&vfs_path)?;
let sr = snap.analysis.source_root_id(file_id)?;
- deps_change_processed = true;
if state.config.script_rebuild_on_save(Some(sr)) && state.build_deps_changed {
state.build_deps_changed = false;
@@ -199,16 +196,6 @@ pub(crate) fn handle_did_save_text_document(
}
}
- if !deps_change_processed
- && state.config.script_rebuild_on_save(None)
- && state.build_deps_changed
- {
- state.build_deps_changed = false;
- state
- .fetch_build_data_queue
- .request_op("build_deps_changed - save notification".to_owned(), ());
- }
-
Ok(())
}
diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs
index 5d77b7aa67..12667e3c90 100644
--- a/crates/rust-analyzer/src/reload.rs
+++ b/crates/rust-analyzer/src/reload.rs
@@ -122,7 +122,7 @@ impl GlobalState {
};
let mut message = String::new();
- if !self.config.cargo_autoreload(None)
+ if !self.config.cargo_autoreload_config(None)
&& self.is_quiescent()
&& self.fetch_workspaces_queue.op_requested()
&& self.config.discover_workspace_config().is_none()