Apply changes, fix path information in a comment in config.rs

This commit is contained in:
Ali Bektas 2024-08-31 03:01:54 +02:00
parent 5e6f5b1f38
commit b17f1eee7d
3 changed files with 4 additions and 19 deletions

View file

@ -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 // To deprecate an option by replacing it with another name use `new_name | `old_name` so that we keep
// parsing the old name. // parsing the old name.
config_data! { config_data! {
/// Configs that apply on a workspace-wide scope. There are 3 levels on which a global configuration can be configured /// Configs that apply on a workspace-wide scope. There are 2 levels on which a global configuration can be configured
// FIXME: 1. and 3. should be split, some configs do not make sense per project
/// ///
/// 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) /// 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. /// 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 -> { global: struct GlobalDefaultConfigData <- GlobalConfigInput -> {
@ -532,7 +530,7 @@ config_data! {
cargo_allTargets: bool = true, cargo_allTargets: bool = true,
/// Automatically refresh project info via `cargo metadata` on /// Automatically refresh project info via `cargo metadata` on
/// `Cargo.toml` or `.cargo/config.toml` changes. /// `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. /// Run build scripts (`build.rs`) for more precise code analysis.
cargo_buildScripts_enable: bool = true, cargo_buildScripts_enable: bool = true,
/// Specifies the invocation strategy to use when running the build scripts command. /// Specifies the invocation strategy to use when running the build scripts command.

View file

@ -145,13 +145,10 @@ pub(crate) fn handle_did_save_text_document(
state: &mut GlobalState, state: &mut GlobalState,
params: DidSaveTextDocumentParams, params: DidSaveTextDocumentParams,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
let mut deps_change_processed = false;
if let Ok(vfs_path) = from_proto::vfs_path(&params.text_document.uri) { if let Ok(vfs_path) = from_proto::vfs_path(&params.text_document.uri) {
let snap = state.snapshot(); let snap = state.snapshot();
let file_id = snap.vfs_path_to_file_id(&vfs_path)?; let file_id = snap.vfs_path_to_file_id(&vfs_path)?;
let sr = snap.analysis.source_root_id(file_id)?; 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 { if state.config.script_rebuild_on_save(Some(sr)) && state.build_deps_changed {
state.build_deps_changed = false; 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(()) Ok(())
} }

View file

@ -122,7 +122,7 @@ impl GlobalState {
}; };
let mut message = String::new(); let mut message = String::new();
if !self.config.cargo_autoreload(None) if !self.config.cargo_autoreload_config(None)
&& self.is_quiescent() && self.is_quiescent()
&& self.fetch_workspaces_queue.op_requested() && self.fetch_workspaces_queue.op_requested()
&& self.config.discover_workspace_config().is_none() && self.config.discover_workspace_config().is_none()