rust-lang / rust-lang/rust-analyzer
Autocomplete of generic functions that require turbofish
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Consider the following function signature:
fn get<T: Component>(&self, entity: Entity) -> Result<Ref<T>, ComponentError>
This has a type parameter T, that does not show up anywhere inside the parameters, requiring you to use turbo fish syntax (or explicitly label a variable with a type, if you're binding to a variable. Or if you are passing this value to a function, you don't really need to give a type at all).
Right now, autocomplete of this function looks like this:
ecs.get(CURSOR)
Instead, it would be helpful if it looked like this:
ecs.get::<CURSOR>(CURSOR_AFTER_TABBING)
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 with the autocomplete behavior described in the issue and trace how rust-analyzer renders generic function calls when the type parameter is absent from the arguments. Verify the change using the provided get<T: Component> example; done means completion offers turbofish syntax while preserving the existing call arguments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- developer-experience, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100