aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsigmaSd2022-12-02 01:18:45 +0000
committerGitHub2022-12-02 01:18:45 +0000
commit4960c41f18d93e8b4c48a7c4e96f00d948cfad5f (patch)
tree95864333284c1511f5c8a2e2a001e917f96f9e17
parent8291654326e0e5ff14830bfade72178b622a9f3c (diff)
feat(lsp): add support for lsp Diagnostic{}.data (#4935)
-rw-r--r--helix-core/src/diagnostic.rs1
-rw-r--r--helix-lsp/src/lib.rs15
-rw-r--r--helix-term/src/application.rs3
3 files changed, 11 insertions, 8 deletions
diff --git a/helix-core/src/diagnostic.rs b/helix-core/src/diagnostic.rs
index db1f2da9..6b5da17e 100644
--- a/helix-core/src/diagnostic.rs
+++ b/helix-core/src/diagnostic.rs
@@ -45,4 +45,5 @@ pub struct Diagnostic {
pub code: Option<NumberOrString>,
pub tags: Vec<DiagnosticTag>,
pub source: Option<String>,
+ pub data: Option<serde_json::Value>,
}
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs
index 5de76c6c..abc930f8 100644
--- a/helix-lsp/src/lib.rs
+++ b/helix-lsp/src/lib.rs
@@ -102,16 +102,17 @@ pub mod util {
None
};
- // TODO: add support for Diagnostic.data
- lsp::Diagnostic::new(
- range_to_lsp_range(doc, range, offset_encoding),
+ lsp::Diagnostic {
+ range: range_to_lsp_range(doc, range, offset_encoding),
severity,
code,
- diag.source.clone(),
- diag.message.to_owned(),
- None,
+ source: diag.source.clone(),
+ message: diag.message.to_owned(),
+ related_information: None,
tags,
- )
+ data: diag.data.to_owned(),
+ ..Default::default()
+ }
}
/// Converts [`lsp::Position`] to a position in the document.
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index dc12ba3c..7a50e007 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -772,7 +772,8 @@ impl Application {
severity,
code,
tags,
- source: diagnostic.source.clone()
+ source: diagnostic.source.clone(),
+ data: diagnostic.data.clone(),
})
})
.collect();