Return more data about located imports

This commit is contained in:
Kirill Bulatov 2021-02-25 01:06:31 +02:00
parent 309421c117
commit 582cee2cdf
9 changed files with 172 additions and 125 deletions

View file

@ -56,7 +56,7 @@ pub(crate) fn render_resolution_with_import<'a>(
ScopeDef::ModuleDef(ModuleDef::Function(f)) => f.name(ctx.completion.db).to_string(),
ScopeDef::ModuleDef(ModuleDef::Const(c)) => c.name(ctx.completion.db)?.to_string(),
ScopeDef::ModuleDef(ModuleDef::TypeAlias(t)) => t.name(ctx.completion.db).to_string(),
_ => import_edit.import_path.segments().last()?.to_string(),
_ => import_edit.import.display_path().segments().last()?.to_string(),
};
Render::new(ctx).render_resolution(local_name, Some(import_edit), resolution).map(|mut item| {
item.completion_kind = CompletionKind::Magic;