mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Merge #5297
5297: Better name r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
a6ac5ac742
2 changed files with 4 additions and 4 deletions
|
@ -92,7 +92,7 @@ pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
|
|||
add_keyword(ctx, acc, "union", "union $0 {}");
|
||||
}
|
||||
|
||||
if ctx.can_be_expr {
|
||||
if ctx.is_expr {
|
||||
add_keyword(ctx, acc, "match", "match $0 {}");
|
||||
add_keyword(ctx, acc, "while", "while $0 {}");
|
||||
add_keyword(ctx, acc, "loop", "loop {$0}");
|
||||
|
|
|
@ -54,7 +54,7 @@ pub(crate) struct CompletionContext<'a> {
|
|||
/// `true` if we are a statement or a last expr in the block.
|
||||
pub(super) can_be_stmt: bool,
|
||||
/// `true` if we expect an expression at the cursor position.
|
||||
pub(super) can_be_expr: bool,
|
||||
pub(super) is_expr: bool,
|
||||
/// Something is typed at the "top" level, in module or impl/trait.
|
||||
pub(super) is_new_item: bool,
|
||||
/// The receiver if this is a field or method access, i.e. writing something.<|>
|
||||
|
@ -129,7 +129,7 @@ impl<'a> CompletionContext<'a> {
|
|||
path_prefix: None,
|
||||
after_if: false,
|
||||
can_be_stmt: false,
|
||||
can_be_expr: false,
|
||||
is_expr: false,
|
||||
is_new_item: false,
|
||||
dot_receiver: None,
|
||||
is_call: false,
|
||||
|
@ -406,7 +406,7 @@ impl<'a> CompletionContext<'a> {
|
|||
None
|
||||
})
|
||||
.unwrap_or(false);
|
||||
self.can_be_expr = path.syntax().parent().and_then(ast::PathExpr::cast).is_some();
|
||||
self.is_expr = path.syntax().parent().and_then(ast::PathExpr::cast).is_some();
|
||||
|
||||
if let Some(off) = name_ref.syntax().text_range().start().checked_sub(2.into()) {
|
||||
if let Some(if_expr) =
|
||||
|
|
Loading…
Reference in a new issue