rust-lang / rust-analyzer

A Rust compiler front-end for IDEs
https://rust-analyzer.github.io/
Apache License 2.0
14.29k stars 1.61k forks source link

Allow us to put fields before trait methods in autocompletion #17847

Open guyguy2001 opened 3 months ago

guyguy2001 commented 3 months ago

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: image image

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:

(keywords: order)

CorvusPrudens commented 2 months ago

I think the first solution you outlined provides substantial utility to the whole Rust ecosystem. For most code bases I work in, fields and inherent methods probably represent the majority of what I access by a fair amount.