racer
racer copied to clipboard
Completion based on trait bounds
Related: #706, #829
General roadmap
- [x] for
FnArg
already implemented in #828, #937
fn f<T: Clone>(a: T) {
let b = a.clo~
}
- [x] for struct member implemented in #948 , #975
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~
}
- [x] associated functions and types implemented in #991
Precise roadmaps
refactor generics support
- [x] Intoroduce ImplHeader #938
- [x] Replace
MatchType::Impl
andMatchType::TraitImpl
with ImplHeader - [x] Remove
Match::generics_args
andMatch::generic_types
- [x] Modify
MatchType::Enum
and etc to have generics - [x] Intoroduce
MatchType::Method
which has ImplHeader ~~- [ ] RemovePathSearch
~~ TOO HARD - [ ] Refactor
TraitBounds
again ~~- [ ] UseGenericsArgs
to resolve type params, instead of takingMatch
~~ Now I think there's no use
enhance scope_start
's inefficiency
- [ ] Have scope cache
Method search
- [x] rewrite method search using ImplHeader
TypeName resolution
- [x] resolve type parameter in ImplHeader when
resolve_path
is called
Related issues
- [ ] Generic type with multiple type parameter(#900) I think this will be easily fixed after refactoring all codes.
Hi! Is struct member method completions working? I can't seem to get completions with the latest master. I am using the same example above
struct S<T> {
mem: T
}
fn f<T: Clone>(a: S<T>) {
let b = a.mem.clo~
}
$ RUST_LOG=racer=trace ../racer/target/debug/racer complete 5 21 src/main.rs 2> trace.txt
PREFIX 71,74,clo
END
Weirdly enough, the testcases in tests/trait_bounds.rs
pass.
Thanks.
Weirdly enough, the testcases in tests/trait_bounds.rs pass.
Tests contain only 'bounded by impl' cases, like
impl<T: Clone> S<T> {
fn f(self) {
let b = a.mem.clo~
}
}
, so it's not weird. I don't remember it's simply not implemented or broken, but anyway fix it later.
Right. I was obviously overlooking that. Sorry. I would like to take a go at this.
On Wed, Oct 17, 2018 at 7:29 AM Yuji Kanagawa [email protected] wrote:
Thanks.
Weirdly enough, the testcases in tests/trait_bounds.rs pass.
Tests contain only 'bounded by impl' cases, like
impl<T: Clone> S<T> { fn f(self) { let b = a.mem.clo~ } }
, so it's not weird. I don't remember it's simply not implemented or broken, but anyway fix it later.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/racer-rust/racer/issues/939#issuecomment-430462432, or mute the thread https://github.com/notifications/unsubscribe-auth/AZcHBLvVtSfCCmh02uQ5gALD8sQAYbcvks5ulo8bgaJpZM4WTPiI .
@letmutx Thanks, but I want to fix this by myself, to recall what I implemented in last month.
@kngwyu Okay. I have some progress here: https://github.com/letmutx/racer/tree/add-struct-member-trait-completions