mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Add completion module tailored towards use trees
This commit is contained in:
parent
6940cca760
commit
661d721e20
12 changed files with 270 additions and 165 deletions
|
@ -452,6 +452,11 @@ impl Module {
|
|||
Module { id: def_map.module_id(def_map.root()) }
|
||||
}
|
||||
|
||||
pub fn is_crate_root(self, db: &dyn HirDatabase) -> bool {
|
||||
let def_map = db.crate_def_map(self.id.krate());
|
||||
def_map.root() == self.id.local_id
|
||||
}
|
||||
|
||||
/// Iterates over all child modules.
|
||||
pub fn children(self, db: &dyn HirDatabase) -> impl Iterator<Item = Module> {
|
||||
let def_map = self.id.def_map(db.upcast());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue