aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-10 16:57:18 +0100
committerGitHub <[email protected]>2020-07-10 16:57:18 +0100
commita6ac5ac7424687b0418463f27bf0c032fbf48bb8 (patch)
tree71ffb649b48ee965ae0c99df422fc0acc3fdbcc5
parent4ff47096f4a4676be1f4991138865a0154fb4731 (diff)
parent3558736582eebdf47a14940143f87f31304430ee (diff)
Merge #5297
5297: Better name r=matklad a=matklad bors r+ 🤖 Co-authored-by: Aleksey Kladov <[email protected]>
-rw-r--r--crates/ra_ide/src/completion/complete_keyword.rs2
-rw-r--r--crates/ra_ide/src/completion/completion_context.rs6
2 files changed, 4 insertions, 4 deletions
diff --git a/crates/ra_ide/src/completion/complete_keyword.rs b/crates/ra_ide/src/completion/complete_keyword.rs
index fe873527f..fcdaeef49 100644
--- a/crates/ra_ide/src/completion/complete_keyword.rs
+++ b/crates/ra_ide/src/completion/complete_keyword.rs
@@ -92,7 +92,7 @@ pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
92 add_keyword(ctx, acc, "union", "union $0 {}"); 92 add_keyword(ctx, acc, "union", "union $0 {}");
93 } 93 }
94 94
95 if ctx.can_be_expr { 95 if ctx.is_expr {
96 add_keyword(ctx, acc, "match", "match $0 {}"); 96 add_keyword(ctx, acc, "match", "match $0 {}");
97 add_keyword(ctx, acc, "while", "while $0 {}"); 97 add_keyword(ctx, acc, "while", "while $0 {}");
98 add_keyword(ctx, acc, "loop", "loop {$0}"); 98 add_keyword(ctx, acc, "loop", "loop {$0}");
diff --git a/crates/ra_ide/src/completion/completion_context.rs b/crates/ra_ide/src/completion/completion_context.rs
index 8e1f6dd98..02811a91e 100644
--- a/crates/ra_ide/src/completion/completion_context.rs
+++ b/crates/ra_ide/src/completion/completion_context.rs
@@ -54,7 +54,7 @@ pub(crate) struct CompletionContext<'a> {
54 /// `true` if we are a statement or a last expr in the block. 54 /// `true` if we are a statement or a last expr in the block.
55 pub(super) can_be_stmt: bool, 55 pub(super) can_be_stmt: bool,
56 /// `true` if we expect an expression at the cursor position. 56 /// `true` if we expect an expression at the cursor position.
57 pub(super) can_be_expr: bool, 57 pub(super) is_expr: bool,
58 /// Something is typed at the "top" level, in module or impl/trait. 58 /// Something is typed at the "top" level, in module or impl/trait.
59 pub(super) is_new_item: bool, 59 pub(super) is_new_item: bool,
60 /// The receiver if this is a field or method access, i.e. writing something.<|> 60 /// The receiver if this is a field or method access, i.e. writing something.<|>
@@ -129,7 +129,7 @@ impl<'a> CompletionContext<'a> {
129 path_prefix: None, 129 path_prefix: None,
130 after_if: false, 130 after_if: false,
131 can_be_stmt: false, 131 can_be_stmt: false,
132 can_be_expr: false, 132 is_expr: false,
133 is_new_item: false, 133 is_new_item: false,
134 dot_receiver: None, 134 dot_receiver: None,
135 is_call: false, 135 is_call: false,
@@ -406,7 +406,7 @@ impl<'a> CompletionContext<'a> {
406 None 406 None
407 }) 407 })
408 .unwrap_or(false); 408 .unwrap_or(false);
409 self.can_be_expr = path.syntax().parent().and_then(ast::PathExpr::cast).is_some(); 409 self.is_expr = path.syntax().parent().and_then(ast::PathExpr::cast).is_some();
410 410
411 if let Some(off) = name_ref.syntax().text_range().start().checked_sub(2.into()) { 411 if let Some(off) = name_ref.syntax().text_range().start().checked_sub(2.into()) {
412 if let Some(if_expr) = 412 if let Some(if_expr) =