racer icon indicating copy to clipboard operation
racer copied to clipboard

Suggestions don't work in closures

Open marmistrz opened this issue 6 years ago • 1 comments

While closure are mentioned in #829, the issue seems to be completely out of sync with what racer supports. (manually annotated closures do work, so does struct member completion)

fn main() {
    let r: Result<char, String> = Ok('a');
    let z = r.map(|x| x.is_~);
}

should suggest e.g. is_digit. If I hover on the x in VS Code, RLS seems to somehow know that x is a char.

If I manually annotate the type

fn main() {
    let r: Result<char, String> = Ok('a');
    let z = r.map(|x: char| x.is_~);
}

the methods are correctly suggested.

marmistrz avatar Jan 31 '19 18:01 marmistrz

That requires type inference implemented in Racer, which I don't believe is something that's ultimately planned. We discussed a possible approach of enhancing the Racer with the type information that RLS already has, which should solve this case.

cc https://github.com/racer-rust/racer/issues/935

Xanewok avatar Feb 05 '19 15:02 Xanewok