diff options
Diffstat (limited to 'crates/ide_completion/src/completions')
-rw-r--r-- | crates/ide_completion/src/completions/keyword.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ide_completion/src/completions/keyword.rs b/crates/ide_completion/src/completions/keyword.rs index 61b667104..d2d0e4a98 100644 --- a/crates/ide_completion/src/completions/keyword.rs +++ b/crates/ide_completion/src/completions/keyword.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use std::iter; | 3 | use std::iter; |
4 | 4 | ||
5 | use syntax::SyntaxKind; | 5 | use syntax::{SyntaxKind, T}; |
6 | 6 | ||
7 | use crate::{CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions}; | 7 | use crate::{CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions}; |
8 | 8 | ||
@@ -54,7 +54,7 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte | |||
54 | add_keyword(ctx, acc, "where", "where "); | 54 | add_keyword(ctx, acc, "where", "where "); |
55 | return; | 55 | return; |
56 | } | 56 | } |
57 | if ctx.unsafe_is_prev { | 57 | if ctx.previous_token_is(T![unsafe]) { |
58 | if ctx.has_item_list_or_source_file_parent || ctx.block_expr_parent { | 58 | if ctx.has_item_list_or_source_file_parent || ctx.block_expr_parent { |
59 | add_keyword(ctx, acc, "fn", "fn $0() {}") | 59 | add_keyword(ctx, acc, "fn", "fn $0() {}") |
60 | } | 60 | } |
@@ -92,7 +92,7 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte | |||
92 | add_keyword(ctx, acc, "for", "for $1 in $0 {}"); | 92 | add_keyword(ctx, acc, "for", "for $1 in $0 {}"); |
93 | } | 93 | } |
94 | 94 | ||
95 | if ctx.if_is_prev || ctx.block_expr_parent { | 95 | if ctx.previous_token_is(T![if]) || ctx.previous_token_is(T![while]) || ctx.block_expr_parent { |
96 | add_keyword(ctx, acc, "let", "let "); | 96 | add_keyword(ctx, acc, "let", "let "); |
97 | } | 97 | } |
98 | 98 | ||