Skip to content

Commit 5478242

Browse files
bors[bot]Veykril
andauthored
Merge #11261
11261: fix: Don't complete attributes with existing expressions r=Veykril a=Veykril Fixes #11254 due to the comment being lowered to an attribute bors r+ Co-authored-by: Lukas Wirth <[email protected]>
2 parents a3393c9 + 51419c1 commit 5478242

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

crates/ide_completion/src/completions/attribute.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ pub(crate) fn complete_attribute(acc: &mut Completions, ctx: &CompletionContext)
5656
_ => (),
5757
},
5858
(_, Some(_)) => (),
59+
(_, None) if attribute.expr().is_some() => (),
5960
(_, None) => complete_new_attribute(acc, ctx, attribute),
6061
}
6162
Some(())

crates/ide_completion/src/tests/attribute.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,19 @@ struct Foo;
4040
)
4141
}
4242

43+
#[test]
44+
fn proc_macros_on_comment() {
45+
check(
46+
r#"
47+
//- proc_macros: identity
48+
/// $0
49+
#[proc_macros::identity]
50+
struct Foo;
51+
"#,
52+
expect![[r#""#]],
53+
)
54+
}
55+
4356
#[test]
4457
fn proc_macros_qualified() {
4558
check(

0 commit comments

Comments
 (0)