Skip to content

Commit

Permalink
LSP: diagnostic picker message and code have no separation
Browse files Browse the repository at this point in the history
  • Loading branch information
Francesc Elies committed Mar 13, 2023
1 parent 621ab0e commit e777902
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions helix-term/src/commands/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ use crate::{
},
};

use std::{
borrow::Cow, cmp::Ordering, collections::BTreeMap, fmt::Write, path::PathBuf, sync::Arc,
};
use std::{cmp::Ordering, collections::BTreeMap, fmt::Write, path::PathBuf, sync::Arc};

/// Gets the language server that is attached to a document, and
/// if it's not active displays a status message. Using this macro
Expand Down Expand Up @@ -132,13 +130,13 @@ impl ui::menu::Item for PickerDiagnostic {
// remove background as it is distracting in the picker list
style.bg = None;

let code: Cow<'_, str> = self
let code = self
.diag
.code
.as_ref()
.map(|c| match c {
NumberOrString::Number(n) => n.to_string().into(),
NumberOrString::String(s) => s.as_str().into(),
NumberOrString::Number(n) => format!(" ({n})"),
NumberOrString::String(s) => format!(" ({s})"),
})
.unwrap_or_default();

Expand Down

0 comments on commit e777902

Please sign in to comment.