Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-completion/src/completions.rs')
-rw-r--r--crates/ide-completion/src/completions.rs15
1 files changed, 6 insertions, 9 deletions
diff --git a/crates/ide-completion/src/completions.rs b/crates/ide-completion/src/completions.rs
index b696933c27..87016a6057 100644
--- a/crates/ide-completion/src/completions.rs
+++ b/crates/ide-completion/src/completions.rs
@@ -40,8 +40,8 @@ use crate::{
literal::{render_struct_literal, render_variant_lit},
macro_::render_macro,
pattern::{render_struct_pat, render_variant_pat},
- render_field, render_path_resolution, render_pattern_resolution, render_tuple_field,
- render_type_tree,
+ render_expr, render_field, render_path_resolution, render_pattern_resolution,
+ render_tuple_field,
type_alias::{render_type_alias, render_type_alias_with_eq},
union_literal::render_union_literal,
RenderContext,
@@ -158,12 +158,8 @@ impl Completions {
item.add_to(self, ctx.db);
}
- pub(crate) fn add_expr(
- &mut self,
- ctx: &CompletionContext<'_>,
- expr: &hir::term_search::TypeTree,
- ) {
- match render_type_tree(ctx, expr) {
+ pub(crate) fn add_expr(&mut self, ctx: &CompletionContext<'_>, expr: &hir::term_search::Expr) {
+ match render_expr(ctx, expr) {
Some(item) => item.add_to(self, ctx.db),
None => (),
}
@@ -699,7 +695,6 @@ pub(super) fn complete_name_ref(
ctx: &CompletionContext<'_>,
NameRefContext { nameref, kind }: &NameRefContext,
) {
- expr::complete_expr(acc, ctx);
match kind {
NameRefKind::Path(path_ctx) => {
flyimport::import_on_the_fly_path(acc, ctx, path_ctx);
@@ -707,6 +702,7 @@ pub(super) fn complete_name_ref(
match &path_ctx.kind {
PathKind::Expr { expr_ctx } => {
expr::complete_expr_path(acc, ctx, path_ctx, expr_ctx);
+ expr::complete_expr(acc, ctx);
dot::complete_undotted_self(acc, ctx, path_ctx, expr_ctx);
item_list::complete_item_list_in_expr(acc, ctx, path_ctx, expr_ctx);
@@ -763,6 +759,7 @@ pub(super) fn complete_name_ref(
flyimport::import_on_the_fly_dot(acc, ctx, dot_access);
dot::complete_dot(acc, ctx, dot_access);
postfix::complete_postfix(acc, ctx, dot_access);
+ expr::complete_expr(acc, ctx);
}
NameRefKind::Keyword(item) => {
keyword::complete_for_and_where(acc, ctx, item);