From 67233f29fb01a4f3faa192d1a0d62866471605b1 Mon Sep 17 00:00:00 2001 From: Ludo Galabru Date: Tue, 4 Jan 2022 14:40:48 -0500 Subject: [PATCH] fix: lsp adjustment --- src/lsp/clarity_language_backend.rs | 31 ++++++++++++++--------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/src/lsp/clarity_language_backend.rs b/src/lsp/clarity_language_backend.rs index ad46cbb46..de13d2f28 100644 --- a/src/lsp/clarity_language_backend.rs +++ b/src/lsp/clarity_language_backend.rs @@ -332,19 +332,21 @@ impl ClarityLanguageBackend { self.client.publish_diagnostics(url, vec![], None).await; } - if !diagnostics.is_empty() { - let erroring_files = diagnostics - .iter() - .map(|(url, _)| { - url.to_file_path() - .unwrap() - .file_name() - .unwrap() - .to_str() - .unwrap() - .to_string() - }) - .collect::>(); + let mut erroring_files = vec![]; + for (url, diagnostic) in diagnostics.into_iter() { + if !diagnostic.is_empty() { + erroring_files.push(url.to_file_path() + .unwrap() + .file_name() + .unwrap() + .to_str() + .unwrap() + .to_string() + ); + } + self.client.publish_diagnostics(url, diagnostic, None).await; + } + if !erroring_files.is_empty() { self.client .show_message( MessageType::Error, @@ -355,9 +357,6 @@ impl ClarityLanguageBackend { ) .await; } - for (url, diagnostic) in diagnostics.into_iter() { - self.client.publish_diagnostics(url, diagnostic, None).await; - } } } }