Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'src/edi/input_handlers/cursor.rs')
| -rw-r--r-- | src/edi/input_handlers/cursor.rs | 63 |
1 files changed, 34 insertions, 29 deletions
diff --git a/src/edi/input_handlers/cursor.rs b/src/edi/input_handlers/cursor.rs index 953d320..8887045 100644 --- a/src/edi/input_handlers/cursor.rs +++ b/src/edi/input_handlers/cursor.rs @@ -3,11 +3,11 @@ use std::sync::Arc; use Default::default; use implicit_fn::implicit_fn; -use lsp_types::request::*; use lsp_types::*; use rust_fsm::StateMachine; use tokio::task::spawn_blocking; use tokio_util::task::AbortOnDropHandle as DropH; +use url::Url; use winit::window::Window; enum Set<T> { To(T), @@ -17,6 +17,7 @@ enum Set<T> { use crate::edi::*; use crate::hov::{DiagnosticHovr, Hoverable, Hovring}; use crate::lsp::BehaviourAfter; +use crate::lsp::communication::send; use crate::rnd::CellBuffer; impl Editor { #[implicit_fn] @@ -221,12 +222,15 @@ impl Editor { .is_none_or(|&(_, x)| x != cursor_position) { let handle = lsp.runtime.spawn( - lsp.request::<lsp_request!("textDocument/definition")>( - &GotoDefinitionParams { - text_document_position_params: tdpp.clone(), - work_done_progress_params: default(), - partial_result_params: default(), - }, + send!( + lsp.request, + "textDocument/definition", + _ { + text_document_position_params: tdpp + .clone(), + work_done_progress_params: default(), + partial_result_params: default(), + }, ) .unwrap() .0, @@ -279,29 +283,30 @@ impl Editor { return Ok(None::<Hovr>); }; let (width, cells) = spawn_blocking(move || { + #[allow(deprecated)] let mut x = match &x.contents { - lsp_types::HoverContents::Scalar( - marked_string, - ) => match marked_string { - MarkedString::LanguageString(x) => - Cow::Borrowed(&*x.value), - MarkedString::String(x) => Cow::Borrowed(&**x), - }, - lsp_types::HoverContents::Array( - marked_strings, - ) => Cow::Owned( - marked_strings - .iter() - .map(|x| match x { - MarkedString::LanguageString(x) => - &*x.value, - MarkedString::String(x) => &*x, - }) - .collect::<String>(), - ), - lsp_types::HoverContents::Markup( - markup_content, - ) => Cow::Borrowed(&*markup_content.value), + Contents::MarkedString(marked_string) => + match marked_string { + MarkedString::MarkedStringWithLanguage( + x, + ) => Cow::Borrowed(&*x.value), + MarkedString::String(x) => + Cow::Borrowed(&**x), + }, + Contents::MarkedStringList(marked_strings) => + Cow::Owned( + marked_strings + .iter() + .map(|x| match x { + MarkedString::MarkedStringWithLanguage( + x, + ) => &*x.value, + MarkedString::String(x) => &*x, + }) + .collect::<String>(), + ), + Contents::MarkupContent(markup_content) => + Cow::Borrowed(&*markup_content.value), }; if l.is_some_and(|l| { matches!( |