mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
internal: tool discovery prefers sysroot tools
This commit is contained in:
parent
ddf105b646
commit
8f3209ba27
14 changed files with 406 additions and 250 deletions
|
@ -89,9 +89,10 @@ impl FlycheckHandle {
|
|||
id: usize,
|
||||
sender: Box<dyn Fn(Message) + Send>,
|
||||
config: FlycheckConfig,
|
||||
cargo: PathBuf,
|
||||
workspace_root: AbsPathBuf,
|
||||
) -> FlycheckHandle {
|
||||
let actor = FlycheckActor::new(id, sender, config, workspace_root);
|
||||
let actor = FlycheckActor::new(id, sender, config, cargo, workspace_root);
|
||||
let (sender, receiver) = unbounded::<StateChange>();
|
||||
let thread = stdx::thread::Builder::new(stdx::thread::ThreadIntent::Worker)
|
||||
.name("Flycheck".to_owned())
|
||||
|
@ -171,6 +172,7 @@ struct FlycheckActor {
|
|||
/// Either the workspace root of the workspace we are flychecking,
|
||||
/// or the project root of the project.
|
||||
root: AbsPathBuf,
|
||||
cargo: PathBuf,
|
||||
/// CargoHandle exists to wrap around the communication needed to be able to
|
||||
/// run `cargo check` without blocking. Currently the Rust standard library
|
||||
/// doesn't provide a way to read sub-process output without blocking, so we
|
||||
|
@ -189,10 +191,11 @@ impl FlycheckActor {
|
|||
id: usize,
|
||||
sender: Box<dyn Fn(Message) + Send>,
|
||||
config: FlycheckConfig,
|
||||
cargo: PathBuf,
|
||||
workspace_root: AbsPathBuf,
|
||||
) -> FlycheckActor {
|
||||
tracing::info!(%id, ?workspace_root, "Spawning flycheck");
|
||||
FlycheckActor { id, sender, config, root: workspace_root, command_handle: None }
|
||||
FlycheckActor { id, sender, config, cargo, root: workspace_root, command_handle: None }
|
||||
}
|
||||
|
||||
fn report_progress(&self, progress: Progress) {
|
||||
|
@ -316,7 +319,7 @@ impl FlycheckActor {
|
|||
ansi_color_output,
|
||||
target_dir,
|
||||
} => {
|
||||
let mut cmd = Command::new(toolchain::cargo());
|
||||
let mut cmd = Command::new(&self.cargo);
|
||||
cmd.arg(command);
|
||||
cmd.current_dir(&self.root);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue