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

Does not complete the local crate in tests/ directory #433

Open
bluss opened this issue Nov 25, 2015 · 2 comments
Open

Does not complete the local crate in tests/ directory #433

bluss opened this issue Nov 25, 2015 · 2 comments

Comments

@bluss
Copy link
Contributor

bluss commented Nov 25, 2015

I have a regular cargo library crate. If I edit files in src/*.rs I can do racer completion of the current crate fine. When editing files in tests/*.rs or benches/*.rs, completion is not available for the current crate (the library crate). Other external crates complete fine in the test source files.

@phildawes
Copy link
Collaborator

@bluss thanks for the issue. If I understand correctly, a test case for this could be:

mycrate/Cargo.toml

[package]
name = "mycrate"
version = "0.1.0"
authors = ["Phil Dawes <[email protected]>"]

mycrate/src/lib.rs

pub fn myfn() {}

mycrate/tests/footest.rs

extern crate mycrate;
mycrate::  <--- complete here should offer 'myfn'

The issue is that racer doesn't locate the lib.rs as being the root module for 'mycrate'. I suspect it should locate the Cargo.toml and notice that the name="mycrate" matches, and then look for src/lib.rs?

  • Is there a better way?
  • Does anybody fancy having a go at implementing this?

(my spare time is currently going on racer using rustc for better completions, so will probably not get to this super soon, but am happy to help anybody else that wants to try)

@bluss
Copy link
Contributor Author

bluss commented Nov 26, 2015

Yes, good description.

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

2 participants