mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
Move CrateDefMap to hir_def
This commit is contained in:
parent
f9f1effd01
commit
ba2efca2bb
23 changed files with 824 additions and 731 deletions
|
@ -18,15 +18,15 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
|
|||
match def {
|
||||
hir::ModuleDef::Module(module) => {
|
||||
let module_scope = module.scope(ctx.db);
|
||||
for (name, res) in module_scope.entries() {
|
||||
if let Some(hir::ModuleDef::BuiltinType(..)) = res.def.take_types() {
|
||||
for (name, def, import) in module_scope {
|
||||
if let hir::ScopeDef::ModuleDef(hir::ModuleDef::BuiltinType(..)) = def {
|
||||
if ctx.use_item_syntax.is_some() {
|
||||
tested_by!(dont_complete_primitive_in_use);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if Some(module) == ctx.module {
|
||||
if let Some(import) = res.import {
|
||||
if let Some(import) = import {
|
||||
if let Either::A(use_tree) = module.import_source(ctx.db, import) {
|
||||
if use_tree.syntax().text_range().contains_inclusive(ctx.offset) {
|
||||
// for `use self::foo<|>`, don't suggest `foo` as a completion
|
||||
|
@ -36,7 +36,7 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
|
|||
}
|
||||
}
|
||||
}
|
||||
acc.add_resolution(ctx, name.to_string(), &res.def.into());
|
||||
acc.add_resolution(ctx, name.to_string(), &def);
|
||||
}
|
||||
}
|
||||
hir::ModuleDef::Adt(_) | hir::ModuleDef::TypeAlias(_) => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue