racer icon indicating copy to clipboard operation
racer copied to clipboard

Feature Request: Determine Inferred Types Operation

Open bruno-medeiros opened this issue 9 years ago • 5 comments

Feature Request: Rust operation to infer and display the type of a variable or expression. Example let foo = "blah"; Run this racer operation with source location at foo, or "blah", Racer displays the name of the inferred type: &str

bruno-medeiros avatar Jul 13 '15 14:07 bruno-medeiros

If I'm not mistaken, racer doesn't infer types except in the simplest cases (types evaluated from macros or pattern matching don't work, for example), so that needs to be improved in order to make this happen.

HybridEidolon avatar Jul 16 '15 14:07 HybridEidolon

Is there a way to ask the rust compiler or one of its component libraries to do the type inference for us, that could be leveraged by racer?

porglezomp avatar Aug 26 '15 04:08 porglezomp

It is the goal to eventually use rustc for type inference, and the rust tools team are working in the direction of making rustc more amenable for tools use, but it is a way off. I've been experimenting with using rustc for type inference, but it is an uphill battle with the current rustc design

On Wed, Aug 26, 2015 at 5:21 AM, Caleb Jones [email protected] wrote:

Is there a way to ask the rust compiler or one of its component libraries to do the type inference for us, that could be leveraged by racer?

— Reply to this email directly or view it on GitHub https://github.com/phildawes/racer/issues/304#issuecomment-134824739.

phildawes avatar Sep 02 '15 08:09 phildawes

any update on this?

runcom avatar Jun 11 '17 17:06 runcom

Would #728 address the specific request here for completions on &'static str literal values? Also, #730 adds a get-type command which should help for some of these cases.

TedDriggs avatar Jun 12 '17 17:06 TedDriggs