Skip to content

Commit d15f972

Browse files
LSP: Separate diagnostic picker message and code (#6095)
1 parent db8e9f5 commit d15f972

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

helix-term/src/commands/lsp.rs

+6-11
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ use crate::{
3232
};
3333

3434
use std::{
35-
borrow::Cow, cmp::Ordering, collections::BTreeMap, fmt::Write, future::Future, path::PathBuf,
36-
sync::Arc,
35+
cmp::Ordering, collections::BTreeMap, fmt::Write, future::Future, path::PathBuf, sync::Arc,
3736
};
3837

3938
/// Gets the language server that is attached to a document, and
@@ -138,15 +137,11 @@ impl ui::menu::Item for PickerDiagnostic {
138137
// remove background as it is distracting in the picker list
139138
style.bg = None;
140139

141-
let code: Cow<'_, str> = self
142-
.diag
143-
.code
144-
.as_ref()
145-
.map(|c| match c {
146-
NumberOrString::Number(n) => n.to_string().into(),
147-
NumberOrString::String(s) => s.as_str().into(),
148-
})
149-
.unwrap_or_default();
140+
let code = match self.diag.code.as_ref() {
141+
Some(NumberOrString::Number(n)) => format!(" ({n})"),
142+
Some(NumberOrString::String(s)) => format!(" ({s})"),
143+
None => String::new(),
144+
};
150145

151146
let path = match format {
152147
DiagnosticsFormat::HideSourcePath => String::new(),

0 commit comments

Comments
 (0)