mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Arc the workspace root flycheck
This commit is contained in:
parent
7aab6a5c12
commit
7da17fe195
@ -1,7 +1,7 @@
|
|||||||
//! Flycheck provides the functionality needed to run `cargo check` to provide
|
//! Flycheck provides the functionality needed to run `cargo check` to provide
|
||||||
//! LSP diagnostics based on the output of the command.
|
//! LSP diagnostics based on the output of the command.
|
||||||
|
|
||||||
use std::{fmt, io, mem, process::Command, time::Duration};
|
use std::{fmt, io, mem, process::Command, sync::Arc, time::Duration};
|
||||||
|
|
||||||
use cargo_metadata::PackageId;
|
use cargo_metadata::PackageId;
|
||||||
use crossbeam_channel::{select_biased, unbounded, Receiver, Sender};
|
use crossbeam_channel::{select_biased, unbounded, Receiver, Sender};
|
||||||
@ -153,7 +153,7 @@ pub(crate) enum FlycheckMessage {
|
|||||||
/// Request adding a diagnostic with fixes included to a file
|
/// Request adding a diagnostic with fixes included to a file
|
||||||
AddDiagnostic {
|
AddDiagnostic {
|
||||||
id: usize,
|
id: usize,
|
||||||
workspace_root: AbsPathBuf,
|
workspace_root: Arc<AbsPathBuf>,
|
||||||
diagnostic: Diagnostic,
|
diagnostic: Diagnostic,
|
||||||
package_id: Option<PackageId>,
|
package_id: Option<PackageId>,
|
||||||
},
|
},
|
||||||
@ -161,7 +161,7 @@ pub(crate) enum FlycheckMessage {
|
|||||||
/// Request clearing all outdated diagnostics.
|
/// Request clearing all outdated diagnostics.
|
||||||
ClearDiagnostics {
|
ClearDiagnostics {
|
||||||
id: usize,
|
id: usize,
|
||||||
/// The pacakge whose diagnostics to clear, or if unspecified, all diagnostics.
|
/// The package whose diagnostics to clear, or if unspecified, all diagnostics.
|
||||||
package_id: Option<PackageId>,
|
package_id: Option<PackageId>,
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ struct FlycheckActor {
|
|||||||
manifest_path: Option<AbsPathBuf>,
|
manifest_path: Option<AbsPathBuf>,
|
||||||
/// Either the workspace root of the workspace we are flychecking,
|
/// Either the workspace root of the workspace we are flychecking,
|
||||||
/// or the project root of the project.
|
/// or the project root of the project.
|
||||||
root: AbsPathBuf,
|
root: Arc<AbsPathBuf>,
|
||||||
sysroot_root: Option<AbsPathBuf>,
|
sysroot_root: Option<AbsPathBuf>,
|
||||||
/// CargoHandle exists to wrap around the communication needed to be able to
|
/// CargoHandle exists to wrap around the communication needed to be able to
|
||||||
/// run `cargo check` without blocking. Currently the Rust standard library
|
/// run `cargo check` without blocking. Currently the Rust standard library
|
||||||
@ -261,7 +261,7 @@ impl FlycheckActor {
|
|||||||
sender,
|
sender,
|
||||||
config,
|
config,
|
||||||
sysroot_root,
|
sysroot_root,
|
||||||
root: workspace_root,
|
root: Arc::new(workspace_root),
|
||||||
manifest_path,
|
manifest_path,
|
||||||
command_handle: None,
|
command_handle: None,
|
||||||
command_receiver: None,
|
command_receiver: None,
|
||||||
@ -431,7 +431,7 @@ impl FlycheckActor {
|
|||||||
cmd.env("RUSTUP_TOOLCHAIN", AsRef::<std::path::Path>::as_ref(sysroot_root));
|
cmd.env("RUSTUP_TOOLCHAIN", AsRef::<std::path::Path>::as_ref(sysroot_root));
|
||||||
}
|
}
|
||||||
cmd.arg(command);
|
cmd.arg(command);
|
||||||
cmd.current_dir(&self.root);
|
cmd.current_dir(&*self.root);
|
||||||
|
|
||||||
match package {
|
match package {
|
||||||
Some(pkg) => cmd.arg("-p").arg(pkg),
|
Some(pkg) => cmd.arg("-p").arg(pkg),
|
||||||
@ -473,11 +473,11 @@ impl FlycheckActor {
|
|||||||
|
|
||||||
match invocation_strategy {
|
match invocation_strategy {
|
||||||
InvocationStrategy::Once => {
|
InvocationStrategy::Once => {
|
||||||
cmd.current_dir(&self.root);
|
cmd.current_dir(&*self.root);
|
||||||
}
|
}
|
||||||
InvocationStrategy::PerWorkspace => {
|
InvocationStrategy::PerWorkspace => {
|
||||||
// FIXME: cmd.current_dir(&affected_workspace);
|
// FIXME: cmd.current_dir(&affected_workspace);
|
||||||
cmd.current_dir(&self.root);
|
cmd.current_dir(&*self.root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user