Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Roadmap for enhancement #829

Open
5 of 15 tasks
kngwyu opened this issue Feb 18, 2018 · 10 comments
Open
5 of 15 tasks

Roadmap for enhancement #829

kngwyu opened this issue Feb 18, 2018 · 10 comments

Comments

@kngwyu
Copy link
Collaborator

kngwyu commented Feb 18, 2018

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

Completions

Completion based on trait bounds(#706)

fn f<T: Clone>(a: T) {
    let b = a.clo~
}
  • for struct member
struct S<T> {
    mem: T
}
fn f<T: Clone>(a: S<T>) {
    let b = a.mem.clo~
}
impl<T: Clone> S<T> {
    fn f(self) {
        let b = a.mem.clo~
    } 
}
  • for closures
fn fun<F: Fn() -> Option<i64>>(f: F) {
    let a = f().unwra~
}

Others

  • closure arguments
let f = |v: Vec<i64>| {
    v.le~
};
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

struct AppHandler {
    name: String,
    app: Box<dyn Application>,
}

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

Misc

'label: loop {
    for i in 0..10 {
         if i == 5 {
            break 'lab~
        }
    }
}

(Though I don't know anyone need this...)

@cynecx
Copy link

cynecx commented Mar 7, 2018

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
Copy link
Collaborator Author

kngwyu commented Mar 7, 2018

@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
Copy link

cynecx commented Mar 7, 2018

@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
Copy link
Collaborator Author

kngwyu commented Mar 7, 2018

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.

@kngwyu kngwyu closed this as completed Mar 22, 2018
@kngwyu kngwyu reopened this Mar 22, 2018
@abbec
Copy link

abbec commented Apr 11, 2018

I would love to see support for use_nested_groups!

@kngwyu
Copy link
Collaborator Author

kngwyu commented Apr 11, 2018

@abbec
use_nested_groups is already supported in my nightly version

@abbec
Copy link

abbec commented Apr 11, 2018

Trying right now :D

@abbec
Copy link

abbec commented Apr 11, 2018

Works, awesome ❤️ !

@Dushistov
Copy link

use_nested_groups is already supported in my nightly version

@kngwyu Any plans to merge it into racer mainline?

@kngwyu
Copy link
Collaborator Author

kngwyu commented May 12, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants