Skip to content

Commit

Permalink
Apply changes, fix path information in a comment in config.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
alibektas committed Aug 31, 2024
1 parent 9edea1e commit 1350769
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 19 deletions.
8 changes: 3 additions & 5 deletions src/tools/rust-analyzer/crates/rust-analyzer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 -> {
Expand Down Expand Up @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(())
}

Expand Down
2 changes: 1 addition & 1 deletion src/tools/rust-analyzer/crates/rust-analyzer/src/reload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 1350769

Please sign in to comment.