mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
fix: format literal lookup
This commit is contained in:
parent
5076f50c7a
commit
91358bd937
7 changed files with 46 additions and 22 deletions
|
@ -10,8 +10,8 @@ use crate::{
|
|||
render::{
|
||||
compute_ref_match, compute_type_match,
|
||||
variant::{
|
||||
format_literal_label, render_record_lit, render_tuple_lit, visible_fields,
|
||||
RenderedLiteral,
|
||||
format_literal_label, format_literal_lookup, render_record_lit, render_tuple_lit,
|
||||
visible_fields, RenderedLiteral,
|
||||
},
|
||||
RenderContext,
|
||||
},
|
||||
|
@ -97,13 +97,20 @@ fn render(
|
|||
if !should_add_parens {
|
||||
kind = StructKind::Unit;
|
||||
}
|
||||
let label = format_literal_label(&qualified_name, kind);
|
||||
let lookup = if qualified {
|
||||
format_literal_lookup(&short_qualified_name.to_string(), kind)
|
||||
} else {
|
||||
format_literal_lookup(&qualified_name, kind)
|
||||
};
|
||||
|
||||
let mut item = CompletionItem::new(
|
||||
CompletionItemKind::SymbolKind(thing.symbol_kind()),
|
||||
ctx.source_range(),
|
||||
format_literal_label(&qualified_name, kind),
|
||||
label,
|
||||
);
|
||||
|
||||
item.lookup_by(lookup);
|
||||
item.detail(rendered.detail);
|
||||
|
||||
match snippet_cap {
|
||||
|
@ -111,9 +118,6 @@ fn render(
|
|||
None => item.insert_text(rendered.literal),
|
||||
};
|
||||
|
||||
if qualified {
|
||||
item.lookup_by(format_literal_label(&short_qualified_name.to_string(), kind));
|
||||
}
|
||||
item.set_documentation(thing.docs(db)).set_deprecated(thing.is_deprecated(&ctx));
|
||||
|
||||
let ty = thing.ty(db);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue