mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Apply changes, fix path information in a comment in config.rs
This commit is contained in:
parent
5e6f5b1f38
commit
b17f1eee7d
3 changed files with 4 additions and 19 deletions
|
@ -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.
|
||||||
|
|
|
@ -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(¶ms.text_document.uri) {
|
if let Ok(vfs_path) = from_proto::vfs_path(¶ms.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(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue