aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorFrancesc Elies2023-03-13 17:01:21 +0000
committerGitHub2023-03-13 17:01:21 +0000
commitd15f9721a51db08790eb10d8c31a5c81b84ac4ee (patch)
treea5ef755ca8a1e27f39fd78858d2351393d4637a8 /helix-term/src
parentdb8e9f5bb2e2b9412cb1cc4688ad2febb726e48c (diff)
LSP: Separate diagnostic picker message and code (#6095)
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/commands/lsp.rs17
1 files changed, 6 insertions, 11 deletions
diff --git a/helix-term/src/commands/lsp.rs b/helix-term/src/commands/lsp.rs
index f71aacf0..13d62b5d 100644
--- a/helix-term/src/commands/lsp.rs
+++ b/helix-term/src/commands/lsp.rs
@@ -32,8 +32,7 @@ use crate::{
};
use std::{
- borrow::Cow, cmp::Ordering, collections::BTreeMap, fmt::Write, future::Future, path::PathBuf,
- sync::Arc,
+ cmp::Ordering, collections::BTreeMap, fmt::Write, future::Future, path::PathBuf, sync::Arc,
};
/// Gets the language server that is attached to a document, and
@@ -138,15 +137,11 @@ impl ui::menu::Item for PickerDiagnostic {
// remove background as it is distracting in the picker list
style.bg = None;
- let code: Cow<'_, str> = self
- .diag
- .code
- .as_ref()
- .map(|c| match c {
- NumberOrString::Number(n) => n.to_string().into(),
- NumberOrString::String(s) => s.as_str().into(),
- })
- .unwrap_or_default();
+ let code = match self.diag.code.as_ref() {
+ Some(NumberOrString::Number(n)) => format!(" ({n})"),
+ Some(NumberOrString::String(s)) => format!(" ({s})"),
+ None => String::new(),
+ };
let path = match format {
DiagnosticsFormat::HideSourcePath => String::new(),