mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Read rust-analyzer.toml files on startup
This commit is contained in:
parent
4afe0d5393
commit
e0db833082
3 changed files with 40 additions and 8 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue