rust-lang / rust-lang/rust-analyzer
Autocomplete not available in panic!() and vec![] macros
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: rust-analyzer version: 0.3.2593-standalone
rustc version: 1.88.0 (6b00bc388 2025-06-23)
editor or extension: VSCode, rust-analyzer 0.3.2593
code snippet to reproduce:
fn main() {
let s = String::new();
let v = vec![s.len(), s.len()];
panic!("{}", s);
}
In this little snippet, when I write out panic!() or vec![] and want to provide it with arguments, the auto-complete in vscode starts failing and doesn't show anything at all, especially when triggered manually via a keyboard shortcut.
I've noticed this issue when I was working with panic! and wrote panic("{}", <cursor>); and triggered auto-complete manually where <cursor> is, and it brought up just text, no symbols or context as it should.
It's worth noting that when I start writing out a symbol that does exist, such as s in this context, then the correct auto-complete does reappear, and it's also worth noting that this isn't an issue with any other macro I've used, I've only observed it with vec![] and panic! and thought I had an error in my code somewhere at first.
Here's a screenshot for more context:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report in VSCode with rust-analyzer 0.3.2593 using the provided Rust snippet. Compare completion triggered in empty arguments to panic!() and vec![] with completion after typing s; done means symbols and relevant context appear in both macro cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100