racer-rust / racer

Rust Code Completion utility
MIT License
3.36k stars 279 forks source link

Roadmap for enhancement #829

Open kngwyu opened 6 years ago

kngwyu commented 6 years ago

Here's a list of functionalities I want to implement in racer. Please comment anything you think!

Completions

Completion based on trait bounds(#706)

use std::ops::Deref;

struct Foo {}

impl Foo {
    fn bar(&self) {
        println!("nights");
    }
}

struct Ref<'a, T: 'a> {
    obj: &'a T,
}

impl<'a, T> Deref for Ref<'a, T> {
    type Target = T;

    fn deref(&self) -> &Self::Target {
        self.obj
    }
}

fn main() {
    let a = Ref { obj: &Foo {} };
    // a. // Auto-complete does not work here
}

Nightly features

Since syntex-syntax isn't maintained now, we need rustc-ap-syntax to support these features.

Misc

cynecx commented 6 years ago

I am not sure if this is just a bug or it's simply not supported:

use std::ops::Deref;

struct Foo {}

impl Foo {
    fn bar(&self) {
        println!("nights");
    }
}

struct Ref<'a, T: 'a> {
    obj: &'a T,
}

impl<'a, T> Deref for Ref<'a, T> {
    type Target = T;

    fn deref(&self) -> &Self::Target {
        self.obj
    }
}

fn main() {
    let a = Ref { obj: &Foo {} };
    // a. // Auto-complete does not work here
}

This doesn't work with rls, but since rls is actually using racer for auto-completion, I assume that it is more appropriate to report this here.

kngwyu commented 6 years ago

@cynecx Are you pointing out that racer doesn't complete a.bar() ? Racer supports method completion based on type coercions by Deref, but if Target is generic type parameter, racer doesn't seem to work well. Though I'm not sure it's a bug or not, I'm going to open a separate issue after checking more deeper. Thanks for reporting!

cynecx commented 6 years ago

@kngwyu Oh yeah, sorry, I forgot to mention that. The field obj and the method deref are shown in the auto-completion set, the method bar however is not included in that set.

kngwyu commented 6 years ago

Hmm... Now I feel this problem more difficult than others in this roadmap, so I decided to add it to this page and not to open separate issue.

abbec commented 6 years ago

I would love to see support for use_nested_groups!

kngwyu commented 6 years ago

@abbec
use_nested_groups is already supported in my nightly version

abbec commented 6 years ago

Trying right now :D

abbec commented 6 years ago

Works, awesome ❤️ !

Dushistov commented 6 years ago

use_nested_groups is already supported in my nightly version

@kngwyu Any plans to merge it into racer mainline?

kngwyu commented 6 years ago

@Dushistov I got push previlege for this repository 2 days ago so I will send a PR soon. Sorry for delay.