Skip to content

Commit f1dbc97

Browse files
committed
Better debug logging in flycheck
1 parent d9c17b5 commit f1dbc97

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

crates/rust-analyzer/src/flycheck.rs

+7-6
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ pub(crate) enum Progress {
230230
DidFailToRestart(String),
231231
}
232232

233-
#[derive(Debug)]
233+
#[derive(Debug, Clone)]
234234
enum PackageToRestart {
235235
All,
236236
// Either a cargo package or a $label in rust-project.check.overrideCommand
@@ -247,7 +247,7 @@ enum FlycheckCommandOrigin {
247247
ProjectJsonRunnable,
248248
}
249249

250-
#[derive(Debug)]
250+
#[derive(Debug, Clone)]
251251
pub(crate) enum PackageSpecifier {
252252
Cargo {
253253
/// The one in Cargo.toml, assumed to work with `cargo check -p {}` etc
@@ -412,8 +412,9 @@ impl FlycheckActor {
412412
}
413413

414414
let Some((command, origin)) =
415-
self.check_command(package, saved_file.as_deref(), target)
415+
self.check_command(package.clone(), saved_file.as_deref(), target)
416416
else {
417+
tracing::debug!(?package, "failed to build flycheck command");
417418
continue;
418419
};
419420

@@ -428,19 +429,19 @@ impl FlycheckActor {
428429
),
429430
};
430431

431-
tracing::debug!(?command, "will restart flycheck");
432+
tracing::debug!(?origin, ?command, "will restart flycheck");
432433
let (sender, receiver) = unbounded();
433434
match CommandHandle::spawn(command, sender) {
434435
Ok(command_handle) => {
435-
tracing::debug!(command = debug_command, "did restart flycheck");
436+
tracing::debug!(?origin, command = %debug_command, "did restart flycheck");
436437
self.command_handle = Some(command_handle);
437438
self.command_receiver = Some(receiver);
438439
self.report_progress(Progress::DidStart { user_facing_command });
439440
self.status = FlycheckStatus::Started;
440441
}
441442
Err(error) => {
442443
self.report_progress(Progress::DidFailToRestart(format!(
443-
"Failed to run the following command: {debug_command} error={error}"
444+
"Failed to run the following command: {debug_command} origin={origin:?} error={error}"
444445
)));
445446
self.status = FlycheckStatus::Finished;
446447
}

0 commit comments

Comments
 (0)