rust-lang / rust-lang/rust-analyzer

Autocomplete of generic functions that require turbofish

Open
#2,890 7 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-completion C-feature E-unknown S-actionable
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.