aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src/context.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/completion/src/context.rs')
-rw-r--r--crates/completion/src/context.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/completion/src/context.rs b/crates/completion/src/context.rs
index 41de324d8..ebf28e887 100644
--- a/crates/completion/src/context.rs
+++ b/crates/completion/src/context.rs
@@ -63,7 +63,7 @@ pub(crate) struct CompletionContext<'a> {
63 pub(super) is_expr: bool, 63 pub(super) is_expr: bool,
64 /// Something is typed at the "top" level, in module or impl/trait. 64 /// Something is typed at the "top" level, in module or impl/trait.
65 pub(super) is_new_item: bool, 65 pub(super) is_new_item: bool,
66 /// The receiver if this is a field or method access, i.e. writing something.<|> 66 /// The receiver if this is a field or method access, i.e. writing something.$0
67 pub(super) dot_receiver: Option<ast::Expr>, 67 pub(super) dot_receiver: Option<ast::Expr>,
68 pub(super) dot_receiver_is_ambiguous_float_literal: bool, 68 pub(super) dot_receiver_is_ambiguous_float_literal: bool,
69 /// If this is a call (method or function) in particular, i.e. the () are already there. 69 /// If this is a call (method or function) in particular, i.e. the () are already there.
@@ -228,9 +228,9 @@ impl<'a> CompletionContext<'a> {
228 228
229 /// Checks whether completions in that particular case don't make much sense. 229 /// Checks whether completions in that particular case don't make much sense.
230 /// Examples: 230 /// Examples:
231 /// - `fn <|>` -- we expect function name, it's unlikely that "hint" will be helpful. 231 /// - `fn $0` -- we expect function name, it's unlikely that "hint" will be helpful.
232 /// Exception for this case is `impl Trait for Foo`, where we would like to hint trait method names. 232 /// Exception for this case is `impl Trait for Foo`, where we would like to hint trait method names.
233 /// - `for _ i<|>` -- obviously, it'll be "in" keyword. 233 /// - `for _ i$0` -- obviously, it'll be "in" keyword.
234 pub(crate) fn no_completion_required(&self) -> bool { 234 pub(crate) fn no_completion_required(&self) -> bool {
235 (self.fn_is_prev && !self.inside_impl_trait_block) || self.for_is_prev2 235 (self.fn_is_prev && !self.inside_impl_trait_block) || self.for_is_prev2
236 } 236 }
@@ -279,7 +279,7 @@ impl<'a> CompletionContext<'a> {
279 offset: TextSize, 279 offset: TextSize,
280 ) { 280 ) {
281 // FIXME: this is wrong in at least two cases: 281 // FIXME: this is wrong in at least two cases:
282 // * when there's no token `foo(<|>)` 282 // * when there's no token `foo($0)`
283 // * when there is a token, but it happens to have type of it's own 283 // * when there is a token, but it happens to have type of it's own
284 self.expected_type = self 284 self.expected_type = self
285 .token 285 .token
@@ -458,7 +458,7 @@ impl<'a> CompletionContext<'a> {
458 } 458 }
459 if let Some(block) = ast::BlockExpr::cast(node) { 459 if let Some(block) = ast::BlockExpr::cast(node) {
460 return Some( 460 return Some(
461 block.expr().map(|e| e.syntax().text_range()) 461 block.tail_expr().map(|e| e.syntax().text_range())
462 == Some(name_ref.syntax().text_range()), 462 == Some(name_ref.syntax().text_range()),
463 ); 463 );
464 } 464 }