aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-06-17 23:30:30 +0100
committerGitHub <[email protected]>2021-06-17 23:30:30 +0100
commit0d863ccea96c6c3256fad12807a0eedbfccd8294 (patch)
treeadf3d745ee501baeef0cb38f26ffc61aa1de5da7 /crates/ide_completion
parentc387ab6de1b860cf74655240a3d89ebe144f0e2c (diff)
parent2ac03ef1d6536955fb53baf25b9777e2a5176837 (diff)
Merge #9313
9313: fix: Don't complete keywords in attributes inside expressions r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <[email protected]>
Diffstat (limited to 'crates/ide_completion')
-rw-r--r--crates/ide_completion/src/completions/attribute.rs3
-rw-r--r--crates/ide_completion/src/completions/keyword.rs4
2 files changed, 5 insertions, 2 deletions
diff --git a/crates/ide_completion/src/completions/attribute.rs b/crates/ide_completion/src/completions/attribute.rs
index 9780d01ae..78fc30e16 100644
--- a/crates/ide_completion/src/completions/attribute.rs
+++ b/crates/ide_completion/src/completions/attribute.rs
@@ -788,13 +788,13 @@ mod tests {
788 at target_feature = "…" 788 at target_feature = "…"
789 at test 789 at test
790 at track_caller 790 at track_caller
791 kw return
792 "#]], 791 "#]],
793 ); 792 );
794 } 793 }
795 794
796 #[test] 795 #[test]
797 fn complete_attribute_on_expr() { 796 fn complete_attribute_on_expr() {
797 cov_mark::check!(no_keyword_completion_in_attr_of_expr);
798 check( 798 check(
799 r#"fn main() { #[$0] foo() }"#, 799 r#"fn main() { #[$0] foo() }"#,
800 expect![[r#" 800 expect![[r#"
@@ -804,7 +804,6 @@ mod tests {
804 at deny(…) 804 at deny(…)
805 at forbid(…) 805 at forbid(…)
806 at warn(…) 806 at warn(…)
807 kw return
808 "#]], 807 "#]],
809 ); 808 );
810 } 809 }
diff --git a/crates/ide_completion/src/completions/keyword.rs b/crates/ide_completion/src/completions/keyword.rs
index c99fdef05..07541c79c 100644
--- a/crates/ide_completion/src/completions/keyword.rs
+++ b/crates/ide_completion/src/completions/keyword.rs
@@ -48,6 +48,10 @@ pub(crate) fn complete_expr_keyword(acc: &mut Completions, ctx: &CompletionConte
48 cov_mark::hit!(no_keyword_completion_in_record_lit); 48 cov_mark::hit!(no_keyword_completion_in_record_lit);
49 return; 49 return;
50 } 50 }
51 if ctx.attribute_under_caret.is_some() {
52 cov_mark::hit!(no_keyword_completion_in_attr_of_expr);
53 return;
54 }
51 55
52 // Suggest .await syntax for types that implement Future trait 56 // Suggest .await syntax for types that implement Future trait
53 if let Some(receiver) = ctx.dot_receiver() { 57 if let Some(receiver) = ctx.dot_receiver() {