mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 13:25:09 +00:00
parent
6908268712
commit
05daa86634
8 changed files with 288 additions and 63 deletions
|
@ -75,6 +75,11 @@ impl Module {
|
|||
Some(Crate::new(crate_id))
|
||||
}
|
||||
|
||||
/// Returns the all modulkes on the way to the root.
|
||||
pub fn path_to_root(&self) -> Vec<Module> {
|
||||
generate(Some(self.clone()), move |it| it.parent()).collect::<Vec<Module>>()
|
||||
}
|
||||
|
||||
/// The root of the tree this module is part of
|
||||
pub fn crate_root(&self) -> Module {
|
||||
let root_id = self.module_id.crate_root(&self.tree);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue