From 42115d02bc9236adf7d1aa81029ca6a12856a160 Mon Sep 17 00:00:00 2001 From: Erasin Date: Tue, 26 Jul 2022 09:26:50 +0800 Subject: Suport diagnostic code (#3096) * add code for diagnostic. This PR provides a solution to resolve #2994. missing Code Actions for lsp * remote unused import--- helix-term/src/application.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'helix-term') diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index 3ee5481f..737b1cad 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -2,6 +2,7 @@ use arc_swap::{access::Map, ArcSwap}; use futures_util::Stream; use helix_core::{ config::{default_syntax_loader, user_syntax_loader}, + diagnostic::NumberOrString, pos_at_coords, syntax, Selection, }; use helix_lsp::{lsp, util::lsp_pos_to_pos, LspProgressMap}; @@ -556,12 +557,24 @@ impl Application { } }; + let code = match diagnostic.code.clone() { + Some(x) => match x { + lsp::NumberOrString::Number(x) => { + Some(NumberOrString::Number(x)) + } + lsp::NumberOrString::String(x) => { + Some(NumberOrString::String(x)) + } + }, + None => None, + }; + Some(Diagnostic { range: Range { start, end }, line: diagnostic.range.start.line as usize, message: diagnostic.message.clone(), severity, - // code + code, // source }) }) -- cgit v1.2.3-70-g09d2