Skip to content
This repository has been archived by the owner on Nov 18, 2022. It is now read-only.

Duplicated completion entries #506

Closed
rpeshkov opened this issue Feb 18, 2019 · 6 comments
Closed

Duplicated completion entries #506

rpeshkov opened this issue Feb 18, 2019 · 6 comments
Labels
bug rls Issue related to the RLS itself rather than the extension

Comments

@rpeshkov
Copy link

I have duplicated entries in completion list. Duplications are not everywhere, but i.e., for env::args(). all functions will be present 3 times.

Here's gif with demo:
2019-02-18 22-56-35 2019-02-18 22_57_05

VSCode: 1.31.1
Extension version: 0.5.3
Any other RLS or Rust completion extension is not installed.

@rpeshkov
Copy link
Author

Ok, so it seems like the problem in RLS itself. What I understood from description - it uses racer for providing completions. Tried to invoke racer manually. Here's the result:

λ racer complete 3 16 src/main.rs | rg collect
MATCH collect,1476,7,/Users/rpeshkov/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/src/libstd/../libcore/iter/iterator.rs,Function,fn collect<B: FromIterator<Self::Item>>(self) -> B where Self: Sized

So, collect occurs only once in racer's result.

Also, launched LSP inspector from Microsoft to check what language server sends to VSCode and found there 3 occurrences of collect function and other functions as well. Log file:
rust.log.

Didn't manage to setup debuggable rls environment. I'm noob in rust. Hope to have success tomorrow :)

@rpeshkov
Copy link
Author

Ok, figured out the problem. Prize goes to racer. I've tested racer completion while I had 2.0 version. RLS is built against 2.1 version. When I checked what happens when I invoke racer complete 3 16 src/main.rs on racer 2.1 - it returns me duplicated entries. It happens because before deduplication of matches, matches are not sorted and dedup_by function removes only consecutive elements.

Made a fix for this behaviour in Racer and opened PR racer-rust/racer#1021

@Xanewok
Copy link
Member

Xanewok commented Mar 17, 2019

Fixed in rust-lang/rls#1402, should be available in the newest nightly toolchain in 1-2 days.

@Xanewok Xanewok added bug rls Issue related to the RLS itself rather than the extension labels Apr 7, 2019
@Xanewok
Copy link
Member

Xanewok commented Apr 7, 2019

Closing this as fixed (remember that it's available since Rust 1.35)

@Xanewok Xanewok closed this as completed Apr 7, 2019
@inancgumus
Copy link

inancgumus commented Jun 2, 2020

@Xanewok I guess this problem continues.

$ racer complete 16 9 src/main.rs
PREFIX 289,289,
MATCH username,2,4,src/main.rs,StructField,String
MATCH email,3,4,src/main.rs,StructField,String
MATCH sign_in_count,4,4,src/main.rs,StructField,u64
MATCH active,5,4,src/main.rs,StructField,bool
END

However, in VS Code, it looks like this:

rust

Please let me know if you need any other debugging information.

@relief-melone
Copy link

at least I'm not the only one. Any updates on this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug rls Issue related to the RLS itself rather than the extension
Projects
None yet
Development

No branches or pull requests

4 participants