I'm building a Rust game with Piston and I'm trying to use the SublimeLinter Rust package. When I open my .rs game files, I get this linter error:
extern crate piston; // linter error: "can't find crate for 'piston'"
If I check the Sublime console, I can see that the linter is finding rustc:
SublimeLinter: rust activated: /usr/local/bin/rustc
I don't see any obvious error messages in the console. I have piston listed as a dependency in my Cargo.toml and I'm able to cargo run
successfully.
I'm a complete Rust & SublimeLinter newbie.
I get a similar error for whichever import I put first; for example if I move extern crate graphics;
to be the first line in the file I get the error "can't find crate for 'graphics'".
EDIT: turns out enabling the "use-cargo" setting fixed the issue. I added a ".sublimelinterrc" file to my project root with these contents:
{
"linters": {
"rust": {
"use-crate-root": true,
"use-cargo": true
}
}
}
use-cargo
fixed it for me. Have you tried setting the crate root and the use-crate-root settings? – Jukebox