mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Initial version of term_search for autocomplete
This commit is contained in:
parent
627255dd5a
commit
bdbdd83ec1
8 changed files with 210 additions and 114 deletions
|
@ -272,6 +272,26 @@ pub(crate) fn render_resolution_with_import_pat(
|
|||
Some(render_resolution_pat(ctx, pattern_ctx, local_name, Some(import_edit), resolution))
|
||||
}
|
||||
|
||||
pub(crate) fn render_type_tree(
|
||||
ctx: &CompletionContext<'_>,
|
||||
expr: &hir::term_search::TypeTree,
|
||||
path_ctx: &PathCompletionCtx,
|
||||
) -> Builder {
|
||||
let mut item = CompletionItem::new(
|
||||
CompletionItemKind::Snippet,
|
||||
ctx.source_range(),
|
||||
expr.gen_source_code(&ctx.scope),
|
||||
);
|
||||
item.set_relevance(crate::CompletionRelevance {
|
||||
type_match: Some(crate::item::CompletionRelevanceTypeMatch::CouldUnify),
|
||||
..Default::default()
|
||||
});
|
||||
|
||||
path_ref_match(ctx, path_ctx, &expr.ty(ctx.sema.db), &mut item);
|
||||
|
||||
item
|
||||
}
|
||||
|
||||
fn scope_def_to_name(
|
||||
resolution: ScopeDef,
|
||||
ctx: &RenderContext<'_>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue