on master help sign in
feat(lsp): add support for lsp Diagnostic{}.data (#4935)
commit4960c41f18d93e8b4c48a7c4e96f00d948cfad5f authorsigmaSd <bedisnbiba@gmail.com> dateFri 2 Dec 2022, 02:18 (4 years ago) parent8291654
3 files changed+11−8
helix-core/src/diagnostic.rs+1 helix-lsp/src/lib.rs+8−7 helix-term/src/application.rs+2−1
helix-core/src/diagnostic.rs+1
@@ -45,4 +45,5 @@ pub struct Diagnostic {
4545 pub code: Option<NumberOrString>,
4646 pub tags: Vec<DiagnosticTag>,
4747 pub source: Option<String>,
48+ pub data: Option<serde_json::Value>,
4849}
helix-lsp/src/lib.rs+8−7
@@ -102,16 +102,17 @@ pub mod util {
102102 None
103103 };
104104
105− // TODO: add support for Diagnostic.data
106− lsp::Diagnostic::new(
107− range_to_lsp_range(doc, range, offset_encoding),
105+ lsp::Diagnostic {
106+ range: range_to_lsp_range(doc, range, offset_encoding),
108107 severity,
109108 code,
110− diag.source.clone(),
111− diag.message.to_owned(),
112− None,
109+ source: diag.source.clone(),
110+ message: diag.message.to_owned(),
111+ related_information: None,
113112 tags,
114− )
113+ data: diag.data.to_owned(),
114+ ..Default::default()
115+ }
115116 }
116117
117118 /// Converts [`lsp::Position`] to a position in the document.
helix-term/src/application.rs+2−1
@@ -772,7 +772,8 @@ impl Application {
772772 severity,
773773 code,
774774 tags,
775− source: diagnostic.source.clone()
775+ source: diagnostic.source.clone(),
776+ data: diagnostic.data.clone(),
776777 })
777778 })
778779 .collect();