aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src
diff options
context:
space:
mode:
authorLuke Cycon2022-09-20 07:21:15 +0000
committerGitHub2022-09-20 07:21:15 +0000
commit64b074541363c72534dc86d00053ecbd5511a9ca (patch)
treed539352a10e301210b89ef0f2cd13f863474081e /helix-term/src
parent130793dfd06306d1f9d25c150c2dc456cda3f9ed (diff)
Track source and tags in diagnostics (#3898)
Diffstat (limited to 'helix-term/src')
-rw-r--r--helix-term/src/application.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs
index 7ee5b7f1..496464f0 100644
--- a/helix-term/src/application.rs
+++ b/helix-term/src/application.rs
@@ -2,7 +2,7 @@ use arc_swap::{access::Map, ArcSwap};
use futures_util::Stream;
use helix_core::{
config::{default_syntax_loader, user_syntax_loader},
- diagnostic::NumberOrString,
+ diagnostic::{DiagnosticTag, NumberOrString},
pos_at_coords, syntax, Selection,
};
use helix_lsp::{lsp, util::lsp_pos_to_pos, LspProgressMap};
@@ -605,13 +605,28 @@ impl Application {
None => None,
};
+ let tags = if let Some(ref tags) = diagnostic.tags {
+ let new_tags = tags.iter().filter_map(|tag| {
+ match *tag {
+ lsp::DiagnosticTag::DEPRECATED => Some(DiagnosticTag::Deprecated),
+ lsp::DiagnosticTag::UNNECESSARY => Some(DiagnosticTag::Unnecessary),
+ _ => None
+ }
+ }).collect();
+
+ Some(new_tags)
+ } else {
+ None
+ };
+
Some(Diagnostic {
range: Range { start, end },
line: diagnostic.range.start.line as usize,
message: diagnostic.message.clone(),
severity,
code,
- // source
+ tags,
+ source: diagnostic.source.clone()
})
})
.collect();