aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/context.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion/src/context.rs')
-rw-r--r--crates/ide_completion/src/context.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs
index 2c2a4aa6b..a8437d81c 100644
--- a/crates/ide_completion/src/context.rs
+++ b/crates/ide_completion/src/context.rs
@@ -276,6 +276,10 @@ impl<'a> CompletionContext<'a> {
276 matches!(self.completion_location, Some(ImmediateLocation::ItemList)) 276 matches!(self.completion_location, Some(ImmediateLocation::ItemList))
277 } 277 }
278 278
279 pub(crate) fn expects_generic_arg(&self) -> bool {
280 matches!(self.completion_location, Some(ImmediateLocation::GenericArgList(_)))
281 }
282
279 pub(crate) fn has_block_expr_parent(&self) -> bool { 283 pub(crate) fn has_block_expr_parent(&self) -> bool {
280 matches!(self.completion_location, Some(ImmediateLocation::BlockExpr)) 284 matches!(self.completion_location, Some(ImmediateLocation::BlockExpr))
281 } 285 }
@@ -380,7 +384,7 @@ impl<'a> CompletionContext<'a> {
380 (|| { 384 (|| {
381 let expr_field = self.token.prev_sibling_or_token()? 385 let expr_field = self.token.prev_sibling_or_token()?
382 .into_node() 386 .into_node()
383 .and_then(|node| ast::RecordExprField::cast(node))?; 387 .and_then(ast::RecordExprField::cast)?;
384 let (_, _, ty) = self.sema.resolve_record_field(&expr_field)?; 388 let (_, _, ty) = self.sema.resolve_record_field(&expr_field)?;
385 Some(( 389 Some((
386 Some(ty), 390 Some(ty),
@@ -467,7 +471,7 @@ impl<'a> CompletionContext<'a> {
467 self.expected_type = expected_type; 471 self.expected_type = expected_type;
468 self.expected_name = expected_name; 472 self.expected_name = expected_name;
469 473
470 let name_like = match find_node_at_offset(&&file_with_fake_ident, offset) { 474 let name_like = match find_node_at_offset(&file_with_fake_ident, offset) {
471 Some(it) => it, 475 Some(it) => it,
472 None => return, 476 None => return,
473 }; 477 };