Skip to content

fix: Add option to report load progress messages #11299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions crates/project_model/src/cargo_workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ pub struct CargoConfig {
/// rustc target
pub target: Option<String>,

/// 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,
Expand Down
3 changes: 3 additions & 0 deletions crates/rust-analyzer/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this should be in the cargo category, these messages are our VFS loading files from disk, not Cargo

/// Compilation target (target triple).
cargo_target: Option<String> = "null",
/// Internal config for debugging, disables loading of sysroot crates.
Expand Down Expand Up @@ -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()),
Expand Down
14 changes: 8 additions & 6 deletions crates/rust-analyzer/src/main_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions docs/user/generated_config.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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`)::
+
--
Expand Down
5 changes: 5 additions & 0 deletions editors/code/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down