diff options
Diffstat (limited to 'crates/ide/src/completion/completion_context.rs')
-rw-r--r-- | crates/ide/src/completion/completion_context.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/crates/ide/src/completion/completion_context.rs b/crates/ide/src/completion/completion_context.rs index 671b13328..842d1987c 100644 --- a/crates/ide/src/completion/completion_context.rs +++ b/crates/ide/src/completion/completion_context.rs | |||
@@ -74,6 +74,8 @@ pub(crate) struct CompletionContext<'a> { | |||
74 | pub(super) is_pattern_call: bool, | 74 | pub(super) is_pattern_call: bool, |
75 | /// If this is a macro call, i.e. the () are already there. | 75 | /// If this is a macro call, i.e. the () are already there. |
76 | pub(super) is_macro_call: bool, | 76 | pub(super) is_macro_call: bool, |
77 | /// If this is a string literal, like "lorem ipsum". | ||
78 | pub(super) is_string_literal: bool, | ||
77 | pub(super) is_path_type: bool, | 79 | pub(super) is_path_type: bool, |
78 | pub(super) has_type_args: bool, | 80 | pub(super) has_type_args: bool, |
79 | pub(super) attribute_under_caret: Option<ast::Attr>, | 81 | pub(super) attribute_under_caret: Option<ast::Attr>, |
@@ -156,6 +158,7 @@ impl<'a> CompletionContext<'a> { | |||
156 | is_call: false, | 158 | is_call: false, |
157 | is_pattern_call: false, | 159 | is_pattern_call: false, |
158 | is_macro_call: false, | 160 | is_macro_call: false, |
161 | is_string_literal: false, | ||
159 | is_path_type: false, | 162 | is_path_type: false, |
160 | has_type_args: false, | 163 | has_type_args: false, |
161 | dot_receiver_is_ambiguous_float_literal: false, | 164 | dot_receiver_is_ambiguous_float_literal: false, |
@@ -469,7 +472,13 @@ impl<'a> CompletionContext<'a> { | |||
469 | } | 472 | } |
470 | } else { | 473 | } else { |
471 | false | 474 | false |
472 | } | 475 | }; |
476 | |||
477 | self.is_string_literal = if let Some(ast::Expr::Literal(l)) = &self.dot_receiver { | ||
478 | matches!(l.kind(), ast::LiteralKind::String { .. }) | ||
479 | } else { | ||
480 | false | ||
481 | }; | ||
473 | } | 482 | } |
474 | if let Some(method_call_expr) = ast::MethodCallExpr::cast(parent) { | 483 | if let Some(method_call_expr) = ast::MethodCallExpr::cast(parent) { |
475 | // As above | 484 | // As above |