mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 01:16:18 +04:00
feat(lsp): add support for lsp Diagnostic{}.data (#4935)
This commit is contained in:
parent
8291654326
commit
4960c41f18
@ -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>,
|
||||
}
|
||||
|
@ -102,16 +102,17 @@ pub fn diagnostic_to_lsp_diagnostic(
|
||||
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.
|
||||
|
@ -772,7 +772,8 @@ pub async fn handle_language_server_message(
|
||||
severity,
|
||||
code,
|
||||
tags,
|
||||
source: diagnostic.source.clone()
|
||||
source: diagnostic.source.clone(),
|
||||
data: diagnostic.data.clone(),
|
||||
})
|
||||
})
|
||||
.collect();
|
||||
|
Loading…
Reference in New Issue
Block a user