rust-lang / rust-lang/rust-analyzer
No completion in Rocket `routes` macro
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Trying out the basic Rocket example, I noticed we don't provide completions in the routes macro, and I'm not sure why.
#[macro_use] extern crate rocket;
#[get("/")]
fn index() -> &'static str {
"Hello, world!"
}
#[launch]
fn rocket() -> _ {
rocket::build().mount("/", routes![ind/*cursor here*/])
}
Macro-expanding the routes! call gives:
{
let ___vec: ::std::vec::Vec< ::rocket::Route> = (<[_]>::into_vec(box[{
let ___struct = ind{}
;
let ___item: ::rocket::Route = ___struct.into_route();
___item
}]));
___vec
}
so the ind token shows up in the expanded code, and in a position where we would provide completions. And we do provide the generated index struct as a completion outside the macro call. Maybe we lose track of the token identity / spans somehow?
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
Start by tracing completion handling for the routes! macro expansion at the ind cursor, then compare it with completion for the generated index struct outside the macro call. Done means the index route completion is available at the cursor inside routes! without regressing the existing completion behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100