rust-lang / rust-lang/rust-analyzer
Autocomplete breaks inside macro
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: v0.3.1091
rustc version: 1.61
relevant settings: None, clean install
In my project I have several files that define logic via closures stored within vectors. The structure of the code roughly looks like this:
pub fn gold_mine() -> CardDefinition {
CardDefinition {
name: CardName::GoldMine,
abilities: vec![
simple_ability(
at_dusk(|g, s, _| {
mutations::take_stored_mana(g, s.card_id(), 3, OnZeroStored::Sacrifice)?;
Ok(())
}),
),
],
config: CardConfig::default(),
}
}
Autocomplete via rust analyzer breaks within these closures in all of the files in my project. It works as expected outside of them.
This reproduces for me in a brand new installation of ubuntu 22.04 running Visual Studio Code and rust-analyzer. You should be able to reproduce it via:
git clone https://github.com/thurn/Spelldawn.git
git checkout 2ed24d0 (the exact point of the screenshot above)
rm .cargo/config.toml (if you don't have the lld linker installed, but the issue reproduces either way)
cargo build
open crates/cards/src/projects.rs (or any file in this directory really)
attempt to use auto-complete inside one of the closures, e.g. on line 43
This also reproduced for me on Mac OSX.
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 failure by cloning Spelldawn, checking out 2ed24d0, building with cargo, and opening crates/cards/src/projects.rs in Visual Studio Code. Test autocomplete inside and outside the closures, then trace the rust-analyzer behavior involved; done means autocomplete works inside these closures as well as elsewhere.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, vscode
- Domain
- developer-experience, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100