Read rust-analyzer.toml files on startup

This commit is contained in:
Ali Bektas 2024-07-22 02:42:39 +02:00
parent 4afe0d5393
commit e0db833082
3 changed files with 40 additions and 8 deletions

View file

@ -291,6 +291,11 @@ impl ProjectJson {
self.manifest.as_ref().map_or(&self.project_root, |manifest| manifest.as_ref())
}
/// Returns the path to the project's root folder.
pub fn project_root(&self) -> &AbsPath {
&self.project_root
}
pub fn runnables(&self) -> &[Runnable] {
&self.runnables
}

View file

@ -523,6 +523,14 @@ impl ProjectWorkspace {
}
}
pub fn workspace_root(&self) -> &AbsPath {
match &self.kind {
ProjectWorkspaceKind::Cargo { cargo, .. } => cargo.workspace_root(),
ProjectWorkspaceKind::Json(project) => project.project_root(),
ProjectWorkspaceKind::DetachedFile { file, .. } => file.parent(),
}
}
pub fn manifest(&self) -> Option<&ManifestPath> {
match &self.kind {
ProjectWorkspaceKind::Cargo { cargo, .. } => Some(cargo.manifest_path()),