mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 22:01:37 +00:00
resolve_path works with DefIds
This commit is contained in:
parent
aa7fd563a4
commit
192e2bbb0e
3 changed files with 46 additions and 11 deletions
|
@ -13,6 +13,7 @@ use crate::{
|
|||
descriptors::{
|
||||
module::{ModuleDescriptor},
|
||||
function::FnScopes,
|
||||
Def,
|
||||
Path,
|
||||
},
|
||||
Cancelable
|
||||
|
@ -156,10 +157,14 @@ fn complete_path(
|
|||
return Ok(());
|
||||
}
|
||||
path.segments.pop();
|
||||
let target_module = match module.resolve_path(db, path)? {
|
||||
let def_id = match module.resolve_path(db, path)? {
|
||||
None => return Ok(()),
|
||||
Some(it) => it,
|
||||
};
|
||||
let target_module = match def_id.resolve(db)? {
|
||||
Def::Module(it) => it,
|
||||
Def::Item => return Ok(()),
|
||||
};
|
||||
let module_scope = target_module.scope(db)?;
|
||||
let completions = module_scope.entries().map(|(name, _res)| CompletionItem {
|
||||
label: name.to_string(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue