Fix some tests

This commit is contained in:
Kirill Bulatov 2021-02-25 01:53:59 +02:00
parent 582cee2cdf
commit d386481fac
4 changed files with 143 additions and 49 deletions

View file

@ -13,7 +13,10 @@ mod builder_ext;
use hir::{
AsAssocItem, Documentation, HasAttrs, HirDisplay, ModuleDef, Mutability, ScopeDef, Type,
};
use ide_db::{helpers::SnippetCap, RootDatabase, SymbolKind};
use ide_db::{
helpers::{item_name, SnippetCap},
RootDatabase, SymbolKind,
};
use syntax::TextRange;
use crate::{
@ -56,7 +59,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.display_path().segments().last()?.to_string(),
_ => item_name(ctx.db(), import_edit.import.item_to_display())?.to_string(),
};
Render::new(ctx).render_resolution(local_name, Some(import_edit), resolution).map(|mut item| {
item.completion_kind = CompletionKind::Magic;