Skip to content

Commit 0d863cc

Browse files
bors[bot]Veykril
andauthored
9313: fix: Don't complete keywords in attributes inside expressions r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 parents c387ab6 + 2ac03ef commit 0d863cc

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

crates/ide_completion/src/completions/attribute.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -788,13 +788,13 @@ mod tests {
788788
at target_feature = "…"
789789
at test
790790
at track_caller
791-
kw return
792791
"#]],
793792
);
794793
}
795794

796795
#[test]
797796
fn complete_attribute_on_expr() {
797+
cov_mark::check!(no_keyword_completion_in_attr_of_expr);
798798
check(
799799
r#"fn main() { #[$0] foo() }"#,
800800
expect![[r#"
@@ -804,7 +804,6 @@ mod tests {
804804
at deny(…)
805805
at forbid(…)
806806
at warn(…)
807-
kw return
808807
"#]],
809808
);
810809
}

crates/ide_completion/src/completions/keyword.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
4848
cov_mark::hit!(no_keyword_completion_in_record_lit);
4949
return;
5050
}
51+
if ctx.attribute_under_caret.is_some() {
52+
cov_mark::hit!(no_keyword_completion_in_attr_of_expr);
53+
return;
54+
}
5155

5256
// Suggest .await syntax for types that implement Future trait
5357
if let Some(receiver) = ctx.dot_receiver() {

0 commit comments

Comments
 (0)