diff options
Diffstat (limited to 'crates/ide_completion/src/completions/postfix.rs')
-rw-r--r-- | crates/ide_completion/src/completions/postfix.rs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/crates/ide_completion/src/completions/postfix.rs b/crates/ide_completion/src/completions/postfix.rs index 962aaf0df..86bbb58e2 100644 --- a/crates/ide_completion/src/completions/postfix.rs +++ b/crates/ide_completion/src/completions/postfix.rs | |||
@@ -14,6 +14,7 @@ use crate::{ | |||
14 | completions::postfix::format_like::add_format_like_completions, | 14 | completions::postfix::format_like::add_format_like_completions, |
15 | context::CompletionContext, | 15 | context::CompletionContext, |
16 | item::{Builder, CompletionKind}, | 16 | item::{Builder, CompletionKind}, |
17 | patterns::ImmediateLocation, | ||
17 | CompletionItem, CompletionItemKind, Completions, | 18 | CompletionItem, CompletionItemKind, Completions, |
18 | }; | 19 | }; |
19 | 20 | ||
@@ -22,13 +23,16 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) { | |||
22 | return; | 23 | return; |
23 | } | 24 | } |
24 | 25 | ||
25 | let dot_receiver = match &ctx.dot_receiver { | 26 | let (dot_receiver, receiver_is_ambiguous_float_literal) = match &ctx.completion_location { |
26 | Some(it) => it, | 27 | Some(ImmediateLocation::MethodCall { receiver: Some(it) }) => (it, false), |
27 | None => return, | 28 | Some(ImmediateLocation::FieldAccess { |
29 | receiver: Some(it), | ||
30 | receiver_is_ambiguous_float_literal, | ||
31 | }) => (it, *receiver_is_ambiguous_float_literal), | ||
32 | _ => return, | ||
28 | }; | 33 | }; |
29 | 34 | ||
30 | let receiver_text = | 35 | let receiver_text = get_receiver_text(dot_receiver, receiver_is_ambiguous_float_literal); |
31 | get_receiver_text(dot_receiver, ctx.dot_receiver_is_ambiguous_float_literal); | ||
32 | 36 | ||
33 | let receiver_ty = match ctx.sema.type_of_expr(&dot_receiver) { | 37 | let receiver_ty = match ctx.sema.type_of_expr(&dot_receiver) { |
34 | Some(it) => it, | 38 | Some(it) => it, |
@@ -123,8 +127,7 @@ pub(crate) fn complete_postfix(acc: &mut Completions, ctx: &CompletionContext) { | |||
123 | // The rest of the postfix completions create an expression that moves an argument, | 127 | // The rest of the postfix completions create an expression that moves an argument, |
124 | // so it's better to consider references now to avoid breaking the compilation | 128 | // so it's better to consider references now to avoid breaking the compilation |
125 | let dot_receiver = include_references(dot_receiver); | 129 | let dot_receiver = include_references(dot_receiver); |
126 | let receiver_text = | 130 | let receiver_text = get_receiver_text(&dot_receiver, receiver_is_ambiguous_float_literal); |
127 | get_receiver_text(&dot_receiver, ctx.dot_receiver_is_ambiguous_float_literal); | ||
128 | 131 | ||
129 | match try_enum { | 132 | match try_enum { |
130 | Some(try_enum) => match try_enum { | 133 | Some(try_enum) => match try_enum { |