Stream: t-compiler/rust-analyzer

Topic: type-based smart completions


Andrew Chin (eminence) (May 24 2021 at 17:24, on Zulip):

I wonder if it would be possible to use types as hints about how to order/prioritize completions. For example, If I write:

let max: usize = my_vec.<|>

an initiate completions on my_vec, it would be Super Cool if RA could prioritize things that return a usize

Jonas Schievink [he/him] (May 24 2021 at 17:28, on Zulip):

We have that to some extent already

Jonas Schievink [he/him] (May 24 2021 at 17:28, on Zulip):

Maybe not everywhere though, not totally sure

Lukas Wirth (May 24 2021 at 17:31, on Zulip):

We mostly use it to show qualified enum variants I think

Andrew Chin (eminence) (May 24 2021 at 17:33, on Zulip):

yeah, it works pretty well there i think

Florian Diebold (May 24 2021 at 18:11, on Zulip):

don't we also use it to prioritize completions? maybe not for method return types

Andrew Chin (eminence) (May 24 2021 at 18:17, on Zulip):

ahh, yes i do see some prioritization based on types. for example, completing within my_vec.push() will prioritize types that can actually fit in the Vec

Last update: Jul 28 2021 at 05:00UTC