-
Notifications
You must be signed in to change notification settings - Fork 279
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
racer does not complete crate from cargo #551
Comments
it seem not search in ~/.cargo/registry/src/ |
Same problem with me. |
I can attest that this is not an isolated issue.
Environment:
Tested package exists in my cargo path:
|
|
This is one of the biggest issues I have working with Rust from Emacs. Lack of completion for third-party libraries makes it much more painful to use many of them than it should be. Can anyone provide a good starting point for how one could debug/fix this issue? It seems that the relevant code is somewhere in nameres.rs/cargo.rs (or the interaction between them), but I haven't found a good way to reliably test changes as I make them. |
Does this affect all third party crates, or just some? I've found the third party crate support to be good overall, but I haven't updated for a while, and it's possible there's been a regression. |
At least the redis crate and rust-zmq aren't working for me. Do you have an example of one that's working for you so I can test it out on my setup? |
The Redis crate suffers from a known infinite recursion bug in Racer. One crate that works for me is |
Looks like that works for me as well! Seems like I've been getting unlucky to have the dependencies I've been using not work. I guess this becomes more about finding the edge cases in external crate completion then - I would be more than willing to look into this if a current contributor could share with me how they go about testing and verifying their changes. |
I have the same issue: racer couldn't complete anything from cargo. Anyone know how to resolve this? Thanks. |
The same issue on Window 10, but racer seems to complete correctly under my Arch Linux environment. |
I have the same issue. |
For those of you not on windows; are you using multirust? Support for multirust cargo packages was removed back in May. Switching to rustup.rs seems to fix the problem. |
I had what appeared to be the same issue while I was using rustup.rs on OS X, but it's been a couple of weeks since I tried |
@DominoTree there's some other issues which may cause completions to fail, but this seemed like the biggest offender. I've got PRs up for the other issues I'm aware off (TOML parse failure -> panic, dropping a diagnostic builder) |
@jwilm I'm using sublime text. Sometimes it works, and sometimes do not.But it never complete for crate user32-ays. |
@jwilm - I've done a fresh OS install with rustup and built racer from the latest git source, and I'm still unable to complete anything that isn't either in the stdlib or in the current directory. I've pasted a bunch of stuff below - if there's anything else I can provide that would be helpful, please let me know.
|
@DominoTree can you run the complete command with Super appreciate your debugging efforts. |
@jwilm I ran it with
I went ahead and dumped a trace of the syscalls it makes syscalls: syscalls with stack backtraces: |
Hmm, it seems that in Vim, working in a project that uses |
So I've been having similar issues and this ticket (in various forms) seems to be repeated in this project's issues so sharing this find if not mentioned elsewhere or if someone finds this helpful. Just playing around for a bit, this seems to work (although it's a complete hack). I appended my source path with a direct path to iron (the crate I'm most interested in getting working) and now I'm seeing completions.
Sill having issues getting this to work within an editor (even with this path set), but still interesting. |
Can't make it work for third party modules either. Any diagnostics or anything we can gather to help solving this? |
More than having the right diagnostics, the real problem is time. There's not a lot of bandwidth among regular racer contributors to dig into our issue backlog. The time I personally have for Racer has been going towards support for RLS, and next on that list is fixing the stack overflow that can bring down the entire process. We would seriously welcome any help we can get, and I can make time to help land PRs (of which there is a minor backlog at the moment 😞). To answer your question though, I think @DominoTree's comment about working in vim versus not working on the command line would be a good lead to chase down (what's different in these cases?). It seems like the reports here are about not working on the command-line. This matches what I've observed since Racer works fine when called from YCM. |
I've rebuilt my entire environment a few times since I've posted here, but I just checked and on the latest Git version of racer, I am able to use it to complete the I'm going to start hacking around and see if I can figure out what's going on, since it seems that I'm still able to replicate this behavior. |
Thanks @DominoTree! 😄 Looking forward to hear what you find out. |
Just getting started, but at first glance, I think this behavior might be caused by It looks like all it does is check the environment var with Providing a file path, line number, and character number to racer on the command line provides proper completions for third-party crates. I'll keep poking around and see if I can make it behave differently. |
Got a chance to look at this some more and it does look like it's simply that attempting a completion as an argument to racer will not look for any external crates because not in the context of a project or a source file. I think if this were documented more clearly, people wouldn't try to complete crates on the commandline and then assume that racer is broken. We could also have racer try to find the nearest Cargo.toml file and use that, but I think that could introduce even more confusion. I'm also wondering about what benefits there are from having this completion available in the first place, other than quickly testing whether racer works or not. |
@DominoTree thank you so much for continuing to look into this!
I could imagine letting standard library completions work regardless, but for crate looks outside of a project, we should probably just detect that, print an error, and exit. Does that sound reasonable? Also, given your research, did you find that the command line completions work as expected in a project context?
I don't quite understand this part. Are you suggesting the command line completion feature shouldn't exist other than checking that racer is hooked up properly? I think the way the stdio "daemon" mode works is to parse stdin lines as a set of arguments as if the program was run anew, so we can't exactly get rid of it. Even if that weren't true, I'm guessing at least a few people depend on the command line lookups since the feature was added at some point. |
Wait, what? RustDT uses the |
Just tested, and, In my earlier post, I think I'd made some incorrect assumptions about the I'm not really sure about daemon mode, or even potential differences from how racer may be called by RustDT. If RustDT is getting completions by file name and character position, it should work fine. I'm trying to find some time to dig into this some more. Hopefully below illustrates what I'm trying to say.
|
Hey there, I came here because I have this problem on Windows 10 with racer 2.0.6. I appended |
I had an issue where racer did not work at all for nightly for crates from within emacs until I set an environment variable. Racer did work for me on stable in emacs without having to do anything special. To fix the issue, I set the CARGO_HOME environment variable to something like C:\users\David\.cargo I found the fix by googling for the issue and came across people with similar issues and solutions in this thread on reddit: https://www.reddit.com/r/rust/comments/50w0q2/racer_not_autocompleting_on_with_third_party/ I am using rustup. my environment is as follows: |
This issue persists. I'm on OSX and cannot complete from external crates. I can complete from rust-src.
I'm unclear why |
I have same issue. Environment: Linux, Fedora 27. [vlisivka@vlisivka src]$ RUST_SRC_PATH=/home/vlisivka/.rustup/toolchains/stable-i686-unknown-linux-gnu/lib/rustlib/src/rust/src RUST_BACKTRACE=1 CARGO_HOME=$HOME/.cargo RUST_LOG=racer=trace racer complete 2 13 main.rs |
@vlisivka |
@kngwyu Yes, Cargo.lock is generated. I built test project first, then added use nanomsg:: ; to test completion. I checked with strace -e trace=file, and racer does not try to open Cargo.* files.
|
@vlisivka |
Sorry, I made few mistakes. It looks that racer need to be executed in top directory, not in src. Package versions in Cargo.toml must be exact, not "^0.6" or "*", because racer uses versions from Cargo.toml instead of Cargo.lock. But still no luck with completion. |
No luck with find-definition (racer 2.0.12):
|
I could reproduce, but, now I have no idea why racer can't find this crate and it needs more debugging 😨 |
I also have this issue.
I'm working with VS Code and Rust (rls) addon. |
@Bravo555 Try to complete position in file, e.g. |
I think I am running to this issue on Windows 10. I installed the rand crate while going through "the book", but I can't seem to get any completions for it.
Completion on something such as |
For nanomsg crate this problem is fixed in my branch. |
I'm still having issues with this - should the merged PR reference above have fixed the issue, slash has that PR been released? My configurations are as below:
If there's anything I can do to help debug further, please let me know! (Or if I'm doing something wrong - relatively new Rust user here.) |
@sashaweiss |
Thanks for the reply - I played around a bit more, and I've found that it sometimes completes and sometimes doesn't, and I'm having trouble identifying a pattern. Once I have more details to share I can follow up! Thanks again. |
Closed via #855 |
hello I'm encountering the same issue, is there a good reason for closing this issue?
vimrc
Racer can complete std but not any external crate like redis, geo etc |
I still have this issue when running racer from the project folder with |
For people still having issues, please checkout this comment. |
my env:
mac osx ---- 10.11.5
rustc --version ---- rustc 1.10.0-nightly (476fe6eef 2016-05-21)
cargo --version ---- cargo 0.11.0-nightly (259324c 2016-05-20)
racer --version ---- racer 1.2.10
rustup --version ---- rustup 0.1.12 (c6e430a 2016-05-12)
thanks for help
The text was updated successfully, but these errors were encountered: