Skip to content

Commit

Permalink
LSP: Separate diagnostic picker message and code (#6095)
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescElies authored Mar 13, 2023
1 parent db8e9f5 commit d15f972
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions helix-term/src/commands/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(),
Expand Down

0 comments on commit d15f972

Please sign in to comment.