diff --git a/crates/project_model/src/cargo_workspace.rs b/crates/project_model/src/cargo_workspace.rs index c2cf3c4ce3ae..cf26583e5a8f 100644 --- a/crates/project_model/src/cargo_workspace.rs +++ b/crates/project_model/src/cargo_workspace.rs @@ -85,6 +85,9 @@ pub struct CargoConfig { /// rustc target pub target: Option, + /// Send progress notifications during project load. + pub report_loading_progress: bool, + /// Don't load sysroot crates (`std`, `core` & friends). Might be useful /// when debugging isolated issues. pub no_sysroot: bool, diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 1df19ffe780b..b10f9ca95136 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -83,6 +83,8 @@ config_data! { cargo_useRustcWrapperForBuildScripts: bool = "true", /// Do not activate the `default` feature. cargo_noDefaultFeatures: bool = "false", + /// Send progress notifications during project load. + cargo_reportLoadingProgress: bool = "true", /// Compilation target (target triple). cargo_target: Option = "null", /// Internal config for debugging, disables loading of sysroot crates. @@ -777,6 +779,7 @@ impl Config { all_features: self.data.cargo_allFeatures, features: self.data.cargo_features.clone(), target: self.data.cargo_target.clone(), + report_loading_progress: self.data.cargo_reportLoadingProgress, no_sysroot: self.data.cargo_noSysroot, rustc_source, unset_test_crates: UnsetTestCrates::Only(self.data.cargo_unsetTest.clone()), diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs index af987230defd..dfe383b3d65f 100644 --- a/crates/rust-analyzer/src/main_loop.rs +++ b/crates/rust-analyzer/src/main_loop.rs @@ -340,12 +340,14 @@ impl GlobalState { assert_eq!(n_done, n_total); Progress::End }; - self.report_progress( - "Roots Scanned", - state, - Some(format!("{}/{}", n_done, n_total)), - Some(Progress::fraction(n_done, n_total)), - ) + if self.config.cargo().report_loading_progress { + self.report_progress( + "Roots Scanned", + state, + Some(format!("{}/{}", n_done, n_total)), + Some(Progress::fraction(n_done, n_total)), + ) + } } } // Coalesce many VFS event into a single loop turn diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc index f7a533c7c233..9c71bdc3fe11 100644 --- a/docs/user/generated_config.adoc +++ b/docs/user/generated_config.adoc @@ -75,6 +75,11 @@ avoid compiling unnecessary things. -- Do not activate the `default` feature. -- +[[rust-analyzer.cargo.reportLoadingProgress]]rust-analyzer.cargo.reportLoadingProgress (default: `true`):: ++ +-- +Send progress notifications during project load. +-- [[rust-analyzer.cargo.target]]rust-analyzer.cargo.target (default: `null`):: + -- diff --git a/editors/code/package.json b/editors/code/package.json index 2c7d6c3773eb..7dfaddb764a3 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -491,6 +491,11 @@ "default": false, "type": "boolean" }, + "rust-analyzer.cargo.reportLoadingProgress": { + "markdownDescription": "Send progress notifications during project load.", + "default": true, + "type": "boolean" + }, "rust-analyzer.cargo.target": { "markdownDescription": "Compilation target (target triple).", "default": null,