rust-lang / rust-lang/rust-analyzer
Allow us to put fields before trait methods in autocompletion
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
I'm using rust-analyzer in a bevy game project.
Most of my structs derive from Reflect, which adds a lot of trait-methods that spam the autocompletion for me, and hide the actually relevant fields:
I never use the Reflect methods in my own code, I only derive from it so that Bevy (and other core packages) can benefit from it.
IDK how common it for general rust projects to encounter this issue, but from what I've seen it will always happen when working with bevy.
I see 2 solutions for this:
- Make fields appear at the start of the list, alongside methods defined on the object itself, instead of alongside trait methods.
- Allow us to hide methods of a specific trait from the list, or move them to the end.
I could see a world in which some first-class methods are defined in a trait, and you would also not want these methods to get hidden behind all of the unimportantReflectmethods.
(keywords: order)
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 rust-analyzer's completion ordering for struct fields and trait methods, using the reported Bevy and Reflect scenario as the reproduction case. Clarify with maintainers whether fields should be ranked first or whether trait methods should be hideable or movable, then add coverage showing the agreed ordering or filtering behavior.
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
- 35/100