Skip to content

Commit 32555af

Browse files
authored
Merge pull request #20976 from A4-Tacks/comp-after-top-inner-attr
Fix not complete after inner-attr in source-file
2 parents e958534 + 4586a31 commit 32555af

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

src/tools/rust-analyzer/crates/ide-completion/src/context/analysis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,7 @@ fn classify_name_ref<'db>(
16351635
&& let Some(t) = top.first_token()
16361636
&& let Some(prev) =
16371637
t.prev_token().and_then(|t| syntax::algo::skip_trivia_token(t, Direction::Prev))
1638-
&& ![T![;], T!['}'], T!['{']].contains(&prev.kind())
1638+
&& ![T![;], T!['}'], T!['{'], T![']']].contains(&prev.kind())
16391639
{
16401640
// This was inferred to be an item position path, but it seems
16411641
// to be part of some other broken node which leaked into an item

src/tools/rust-analyzer/crates/ide-completion/src/tests/item_list.rs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,40 @@ fn in_item_list_after_attr() {
105105
)
106106
}
107107

108+
#[test]
109+
fn in_item_list_after_inner_attr() {
110+
check_with_base_items(
111+
r#"#![attr] $0"#,
112+
expect![[r#"
113+
ma makro!(…) macro_rules! makro
114+
md module
115+
kw async
116+
kw const
117+
kw crate::
118+
kw enum
119+
kw extern
120+
kw fn
121+
kw impl
122+
kw impl for
123+
kw mod
124+
kw pub
125+
kw pub(crate)
126+
kw pub(super)
127+
kw self::
128+
kw static
129+
kw struct
130+
kw trait
131+
kw type
132+
kw union
133+
kw unsafe
134+
kw use
135+
sn macro_rules
136+
sn tfn (Test function)
137+
sn tmod (Test module)
138+
"#]],
139+
)
140+
}
141+
108142
#[test]
109143
fn in_qualified_path() {
110144
check_with_base_items(

0 commit comments

Comments
 (0)