racer
racer copied to clipboard
Racer should parse the '[[bin]]' directive in cargo.toml to find the crate root
Currently find_possible_crate_root_modules()
just hunts for main.rs
and lib.rs
files. It also needs to use the [[bin]]
directive in the Cargo.toml
Hope this is being worked on! I was getting really frustrated since completion for external crates wasn't working for me, but then I tried completing in a different file, which did work. I noticed that the only thing different was the first file was from my binary crate, while the second file was from my library crate. That led me to search for problems with completion in binary crates, which led me here. My binary crate does use a non-standard name for main.rs
, so that's why racer wasn't able to find the external crates!
If this would be relatively straightforward and no one else is looking at it, I'd be more than happy to lend a hand 😃
Note, see related issue : https://github.com/phildawes/racer/issues/513#issuecomment-214445913
Basically with the recently added cargo metadata
command, if we have Racer read that output, it will provide us with the correct source root for each target in the crate (including test targets).
Alternatively, it's seems very simple to code all the logic to determine the source root of the crate targets (I did this in RustDT for example), so Racer could have this coded itself. But sooner or later, other features like #513 will require the use of cargo metadata
.
It would also be quite helpful to have this feature parsing Cargo.toml's [lib]
section for paths other than just src/lib.rs
.