Add path of workspace root folders to status output

This commit is contained in:
David Barsky 2023-03-13 14:45:41 -04:00
parent 9549753352
commit 677c0eeccb
2 changed files with 18 additions and 1 deletions

View File

@ -450,6 +450,14 @@ impl ProjectWorkspace {
}
}
pub fn workspace_definition_path(&self) -> Option<&AbsPath> {
match self {
ProjectWorkspace::Cargo { cargo, .. } => Some(cargo.workspace_root()),
ProjectWorkspace::Json { project, .. } => Some(project.path()),
ProjectWorkspace::DetachedFiles { .. } => None,
}
}
pub fn find_sysroot_proc_macro_srv(&self) -> Option<AbsPathBuf> {
match self {
ProjectWorkspace::Cargo { sysroot: Some(sysroot), .. }

View File

@ -29,7 +29,7 @@ use project_model::{ManifestPath, ProjectWorkspace, TargetKind};
use serde_json::json;
use stdx::{format_to, never};
use syntax::{algo, ast, AstNode, TextRange, TextSize};
use vfs::AbsPathBuf;
use vfs::{AbsPath, AbsPathBuf};
use crate::{
cargo_target_spec::CargoTargetSpec,
@ -84,6 +84,15 @@ pub(crate) fn handle_analyzer_status(
snap.workspaces.len(),
if snap.workspaces.len() == 1 { "" } else { "s" }
);
format_to!(
buf,
"Workspace root folders: {:?}",
snap.workspaces
.iter()
.flat_map(|ws| ws.workspace_definition_path())
.collect::<Vec<&AbsPath>>()
);
}
buf.push_str("\nAnalysis:\n");
buf.push_str(