diff options
Diffstat (limited to 'crates/ide_completion/src/completions/attribute.rs')
-rw-r--r-- | crates/ide_completion/src/completions/attribute.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/crates/ide_completion/src/completions/attribute.rs b/crates/ide_completion/src/completions/attribute.rs index f3b11e72d..78fc30e16 100644 --- a/crates/ide_completion/src/completions/attribute.rs +++ b/crates/ide_completion/src/completions/attribute.rs | |||
@@ -17,12 +17,14 @@ use crate::{ | |||
17 | 17 | ||
18 | mod derive; | 18 | mod derive; |
19 | mod lint; | 19 | mod lint; |
20 | mod repr; | ||
20 | 21 | ||
21 | pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { | 22 | pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { |
22 | let attribute = ctx.attribute_under_caret.as_ref()?; | 23 | let attribute = ctx.attribute_under_caret.as_ref()?; |
23 | match (attribute.path().and_then(|p| p.as_single_name_ref()), attribute.token_tree()) { | 24 | match (attribute.path().and_then(|p| p.as_single_name_ref()), attribute.token_tree()) { |
24 | (Some(path), Some(token_tree)) => match path.text().as_str() { | 25 | (Some(path), Some(token_tree)) => match path.text().as_str() { |
25 | "derive" => derive::complete_derive(acc, ctx, token_tree), | 26 | "derive" => derive::complete_derive(acc, ctx, token_tree), |
27 | "repr" => repr::complete_repr(acc, ctx, token_tree), | ||
26 | "feature" => lint::complete_lint(acc, ctx, token_tree, FEATURES), | 28 | "feature" => lint::complete_lint(acc, ctx, token_tree, FEATURES), |
27 | "allow" | "warn" | "deny" | "forbid" => { | 29 | "allow" | "warn" | "deny" | "forbid" => { |
28 | lint::complete_lint(acc, ctx, token_tree.clone(), DEFAULT_LINTS); | 30 | lint::complete_lint(acc, ctx, token_tree.clone(), DEFAULT_LINTS); |
@@ -786,13 +788,13 @@ mod tests { | |||
786 | at target_feature = "…" | 788 | at target_feature = "…" |
787 | at test | 789 | at test |
788 | at track_caller | 790 | at track_caller |
789 | kw return | ||
790 | "#]], | 791 | "#]], |
791 | ); | 792 | ); |
792 | } | 793 | } |
793 | 794 | ||
794 | #[test] | 795 | #[test] |
795 | fn complete_attribute_on_expr() { | 796 | fn complete_attribute_on_expr() { |
797 | cov_mark::check!(no_keyword_completion_in_attr_of_expr); | ||
796 | check( | 798 | check( |
797 | r#"fn main() { #[$0] foo() }"#, | 799 | r#"fn main() { #[$0] foo() }"#, |
798 | expect![[r#" | 800 | expect![[r#" |
@@ -802,7 +804,6 @@ mod tests { | |||
802 | at deny(…) | 804 | at deny(…) |
803 | at forbid(…) | 805 | at forbid(…) |
804 | at warn(…) | 806 | at warn(…) |
805 | kw return | ||
806 | "#]], | 807 | "#]], |
807 | ); | 808 | ); |
808 | } | 809 | } |