Skip to content

Commit c03deed

Browse files
committed
Auto-completion no longer occurs on comments
1 parent 0bbd642 commit c03deed

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

crates/ra_ide/src/completion.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ pub(crate) fn completions(
109109
let ctx = CompletionContext::new(db, position, config)?;
110110

111111
let mut acc = Completions::default();
112+
112113
complete_attribute::complete_attribute(&mut acc, &ctx);
113114
complete_fn_param::complete_fn_param(&mut acc, &ctx);
114115
complete_keyword::complete_expr_keyword(&mut acc, &ctx);

crates/ra_ide/src/completion/complete_keyword.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! FIXME: write short doc here
22
3-
use ra_syntax::ast;
3+
use ra_syntax::{ast, SyntaxKind};
44

55
use crate::completion::{
66
CompletionContext, CompletionItem, CompletionItemKind, CompletionKind, Completions,
@@ -37,6 +37,11 @@ pub(super) fn complete_use_tree_keyword(acc: &mut Completions, ctx: &CompletionC
3737
}
3838

3939
pub(super) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionContext) {
40+
41+
if ctx.token.kind() == SyntaxKind::COMMENT {
42+
return;
43+
}
44+
4045
let has_trait_or_impl_parent = ctx.has_impl_parent || ctx.has_trait_parent;
4146
if ctx.trait_as_prev_sibling || ctx.impl_as_prev_sibling {
4247
add_keyword(ctx, acc, "where", "where ");

0 commit comments

Comments
 (0)