aboutsummaryrefslogtreecommitdiff
path: root/helix-lsp
diff options
context:
space:
mode:
authorErasin2022-07-26 01:26:50 +0000
committerGitHub2022-07-26 01:26:50 +0000
commit42115d02bc9236adf7d1aa81029ca6a12856a160 (patch)
tree5181c987d5e68c310d17827b9b1707c317073964 /helix-lsp
parent4f21f430e48fbeb88cd4296310d813d7affd19e6 (diff)
Suport diagnostic code (#3096)
* add code for diagnostic. This PR provides a solution to resolve #2994. missing Code Actions for lsp * remote unused import
Diffstat (limited to 'helix-lsp')
-rw-r--r--helix-lsp/src/lib.rs12
1 files changed, 10 insertions, 2 deletions
diff --git a/helix-lsp/src/lib.rs b/helix-lsp/src/lib.rs
index 6a5f9d5c..b6e36423 100644
--- a/helix-lsp/src/lib.rs
+++ b/helix-lsp/src/lib.rs
@@ -58,7 +58,7 @@ pub enum OffsetEncoding {
pub mod util {
use super::*;
- use helix_core::{Range, Rope, Transaction};
+ use helix_core::{diagnostic::NumberOrString, Range, Rope, Transaction};
/// Converts a diagnostic in the document to [`lsp::Diagnostic`].
///
@@ -78,11 +78,19 @@ pub mod util {
Error => lsp::DiagnosticSeverity::ERROR,
});
+ let code = match diag.code.clone() {
+ Some(x) => match x {
+ NumberOrString::Number(x) => Some(lsp::NumberOrString::Number(x)),
+ NumberOrString::String(x) => Some(lsp::NumberOrString::String(x)),
+ },
+ None => None,
+ };
+
// TODO: add support for Diagnostic.data
lsp::Diagnostic::new(
range_to_lsp_range(doc, range, offset_encoding),
severity,
- None,
+ code,
None,
diag.message.to_owned(),
None,