aboutsummaryrefslogtreecommitdiff
path: root/helix-lsp/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'helix-lsp/src/lib.rs')
-rw-r--r--helix-lsp/src/lib.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs
index 6a5f9d5c..b6e36423 100644
--- a/helix-lsp/src/lib.rs
+++ b/helix-lsp/src/lib.rs
@@ -58,7 +58,7 @@ pub enum OffsetEncoding {
pub mod util {
use super::*;
- use helix_core::{Range, Rope, Transaction};
+ use helix_core::{diagnostic::NumberOrString, Range, Rope, Transaction};
/// Converts a diagnostic in the document to [`lsp::Diagnostic`].
///
@@ -78,11 +78,19 @@ pub mod util {
Error => lsp::DiagnosticSeverity::ERROR,
});
+ let code = match diag.code.clone() {
+ Some(x) => match x {
+ NumberOrString::Number(x) => Some(lsp::NumberOrString::Number(x)),
+ NumberOrString::String(x) => Some(lsp::NumberOrString::String(x)),
+ },
+ None => None,
+ };
+
// TODO: add support for Diagnostic.data
lsp::Diagnostic::new(
range_to_lsp_range(doc, range, offset_encoding),
severity,
- None,
+ code,
None,
diag.message.to_owned(),
None,