aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src/completion/completion_context.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src/completion/completion_context.rs')
-rw-r--r--crates/ra_ide_api/src/completion/completion_context.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/completion/completion_context.rs b/crates/ra_ide_api/src/completion/completion_context.rs
index 73f3f3960..64cbc0f98 100644
--- a/crates/ra_ide_api/src/completion/completion_context.rs
+++ b/crates/ra_ide_api/src/completion/completion_context.rs
@@ -38,6 +38,7 @@ pub(crate) struct CompletionContext<'a> {
38 pub(super) is_new_item: bool, 38 pub(super) is_new_item: bool,
39 /// The receiver if this is a field or method access, i.e. writing something.<|> 39 /// The receiver if this is a field or method access, i.e. writing something.<|>
40 pub(super) dot_receiver: Option<ast::Expr>, 40 pub(super) dot_receiver: Option<ast::Expr>,
41 pub(super) dot_receiver_is_ambiguous_float_literal: bool,
41 /// If this is a call (method or function) in particular, i.e. the () are already there. 42 /// If this is a call (method or function) in particular, i.e. the () are already there.
42 pub(super) is_call: bool, 43 pub(super) is_call: bool,
43 pub(super) is_path_type: bool, 44 pub(super) is_path_type: bool,
@@ -80,6 +81,7 @@ impl<'a> CompletionContext<'a> {
80 is_call: false, 81 is_call: false,
81 is_path_type: false, 82 is_path_type: false,
82 has_type_args: false, 83 has_type_args: false,
84 dot_receiver_is_ambiguous_float_literal: false,
83 }; 85 };
84 ctx.fill(&original_parse, position.offset); 86 ctx.fill(&original_parse, position.offset);
85 Some(ctx) 87 Some(ctx)
@@ -235,6 +237,16 @@ impl<'a> CompletionContext<'a> {
235 .expr() 237 .expr()
236 .map(|e| e.syntax().text_range()) 238 .map(|e| e.syntax().text_range())
237 .and_then(|r| find_node_with_range(original_file.syntax(), r)); 239 .and_then(|r| find_node_with_range(original_file.syntax(), r));
240 self.dot_receiver_is_ambiguous_float_literal = if let Some(ast::Expr::Literal(l)) =
241 &self.dot_receiver
242 {
243 match l.kind() {
244 ast::LiteralKind::FloatNumber { suffix: _ } => l.token().text().ends_with('.'),
245 _ => false,
246 }
247 } else {
248 false
249 }
238 } 250 }
239 if let Some(method_call_expr) = ast::MethodCallExpr::cast(parent) { 251 if let Some(method_call_expr) = ast::MethodCallExpr::cast(parent) {
240 // As above 252 // As above