aboutsummaryrefslogtreecommitdiff
path: root/helix-lsp/src/lib.rs
diff options
context:
space:
mode:
authorLuke Cycon2022-09-20 07:21:15 +0000
committerGitHub2022-09-20 07:21:15 +0000
commit64b074541363c72534dc86d00053ecbd5511a9ca (patch)
treed539352a10e301210b89ef0f2cd13f863474081e /helix-lsp/src/lib.rs
parent130793dfd06306d1f9d25c150c2dc456cda3f9ed (diff)
Track source and tags in diagnostics (#3898)
Diffstat (limited to 'helix-lsp/src/lib.rs')
-rw-r--r--helix-lsp/src/lib.rs22
1 files changed, 20 insertions, 2 deletions
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs
index a39325fa..8c76c4a8 100644
--- a/helix-lsp/src/lib.rs
+++ b/helix-lsp/src/lib.rs
@@ -84,15 +84,33 @@ pub mod util {
None => None,
};
+ let tags = if let Some(ref tags) = diag.tags {
+ let new_tags = tags
+ .iter()
+ .map(|tag| match tag {
+ helix_core::diagnostic::DiagnosticTag::Unnecessary => {
+ lsp::DiagnosticTag::UNNECESSARY
+ }
+ helix_core::diagnostic::DiagnosticTag::Deprecated => {
+ lsp::DiagnosticTag::DEPRECATED
+ }
+ })
+ .collect();
+
+ Some(new_tags)
+ } else {
+ None
+ };
+
// TODO: add support for Diagnostic.data
lsp::Diagnostic::new(
range_to_lsp_range(doc, range, offset_encoding),
severity,
code,
- None,
+ diag.source.clone(),
diag.message.to_owned(),
None,
- None,
+ tags,
)
}