Fix duplicate const complete after raw

Example
---
```rust
fn main() { let _ = &raw $0 }
```

**Before this PR**

```text
fn main() fn()
bt u32     u32
kw const
kw const
kw crate::
...
```

**After this PR**

```text
fn main() fn()
bt u32     u32
kw const
kw crate::
...
```
This commit is contained in:
A4-Tacks 2025-10-30 12:52:59 +08:00
parent 055f39a05e
commit aecab3493b
No known key found for this signature in database
GPG key ID: DBD861323040663B
2 changed files with 4 additions and 2 deletions

View file

@ -352,7 +352,10 @@ pub(crate) fn complete_expr_path(
if !in_block_expr {
add_keyword("unsafe", "unsafe {\n $0\n}");
add_keyword("const", "const {\n $0\n}");
if !wants_const_token {
// Avoid having two `const` items in `&raw $0`
add_keyword("const", "const {\n $0\n}");
}
}
add_keyword("match", "match $1 {\n $0\n}");
add_keyword("while", "while $1 {\n $0\n}");

View file

@ -628,7 +628,6 @@ fn completes_after_ref_expr() {
fn main() fn()
bt u32 u32
kw const
kw const
kw crate::
kw false
kw for