More visibility for switch workspaces and its states
This commit is contained in:
parent
65fbe0a8d1
commit
72fcc66835
@ -236,7 +236,7 @@ impl GlobalState {
|
||||
self.fetch_workspaces_queue.op_completed(workspaces);
|
||||
|
||||
let old = Arc::clone(&self.workspaces);
|
||||
self.switch_workspaces();
|
||||
self.switch_workspaces("fetched workspace".to_string());
|
||||
let workspaces_updated = !Arc::ptr_eq(&old, &self.workspaces);
|
||||
|
||||
if self.config.run_build_scripts() && workspaces_updated {
|
||||
@ -259,7 +259,7 @@ impl GlobalState {
|
||||
BuildDataProgress::End(build_data_result) => {
|
||||
self.fetch_build_data_queue.op_completed(build_data_result);
|
||||
|
||||
self.switch_workspaces();
|
||||
self.switch_workspaces("fetched build data".to_string());
|
||||
|
||||
(Some(Progress::End), None)
|
||||
}
|
||||
|
@ -166,9 +166,9 @@ impl GlobalState {
|
||||
});
|
||||
}
|
||||
|
||||
pub(crate) fn switch_workspaces(&mut self) {
|
||||
pub(crate) fn switch_workspaces(&mut self, cause: Cause) {
|
||||
let _p = profile::span("GlobalState::switch_workspaces");
|
||||
tracing::info!("will switch workspaces");
|
||||
tracing::info!(%cause, "will switch workspaces");
|
||||
|
||||
if let Err(error_message) = self.fetch_workspace_error() {
|
||||
self.show_and_log_error(error_message, None);
|
||||
@ -224,6 +224,8 @@ impl GlobalState {
|
||||
if same_workspaces {
|
||||
let (workspaces, build_scripts) = self.fetch_build_data_queue.last_op_result();
|
||||
if Arc::ptr_eq(workspaces, &self.workspaces) {
|
||||
tracing::debug!("set build scripts to workspaces");
|
||||
|
||||
let workspaces = workspaces
|
||||
.iter()
|
||||
.cloned()
|
||||
@ -237,11 +239,14 @@ impl GlobalState {
|
||||
// Workspaces are the same, but we've updated build data.
|
||||
self.workspaces = Arc::new(workspaces);
|
||||
} else {
|
||||
tracing::info!("build scrips do not match the version of the active workspace");
|
||||
// Current build scripts do not match the version of the active
|
||||
// workspace, so there's nothing for us to update.
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
tracing::debug!("abandon build scripts for workspaces");
|
||||
|
||||
// Here, we completely changed the workspace (Cargo.toml edit), so
|
||||
// we don't care about build-script results, they are stale.
|
||||
self.workspaces = Arc::new(workspaces)
|
||||
|
Loading…
x
Reference in New Issue
Block a user