From 4b59c3a538f27238b0466898f1b4ac69d1f9e778 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 28 Jan 2021 17:04:44 +0300 Subject: Make logger-based debugging more pleasant --- crates/flycheck/src/lib.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'crates/flycheck/src') diff --git a/crates/flycheck/src/lib.rs b/crates/flycheck/src/lib.rs index 4388e8c67..e04208006 100644 --- a/crates/flycheck/src/lib.rs +++ b/crates/flycheck/src/lib.rs @@ -76,7 +76,6 @@ impl FlycheckHandle { } } -#[derive(Debug)] pub enum Message { /// Request adding a diagnostic with fixes included to a file AddDiagnostic { workspace_root: PathBuf, diagnostic: Diagnostic }, @@ -89,6 +88,21 @@ pub enum Message { }, } +impl fmt::Debug for Message { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match self { + Message::AddDiagnostic { workspace_root, diagnostic } => f + .debug_struct("AddDiagnostic") + .field("workspace_root", workspace_root) + .field("diagnostic_code", &diagnostic.code.as_ref().map(|it| &it.code)) + .finish(), + Message::Progress { id, progress } => { + f.debug_struct("Progress").field("id", id).field("progress", progress).finish() + } + } + } +} + #[derive(Debug)] pub enum Progress { DidStart, -- cgit v1.2.3