Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'src/lsp/rq.rs')
| -rw-r--r-- | src/lsp/rq.rs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/lsp/rq.rs b/src/lsp/rq.rs index b7e42e0..50a6fd3 100644 --- a/src/lsp/rq.rs +++ b/src/lsp/rq.rs @@ -4,8 +4,10 @@ use std::marker::PhantomData; use crossbeam::channel::SendError; use lsp_server::{Message, Response as Re}; -use lsp_types::DiagnosticServerCancellationData; -use lsp_types::request::Request; +use lsp_types::{ + DiagnosticServerCancellationData, LspRequestMethod, MessageDirection, + Request, +}; use serde::{Deserialize, Serialize}; use tokio::sync::oneshot; use tokio::task; @@ -26,7 +28,10 @@ pub type AQErr = RequestError<LSPError>; impl Request for LSPError { type Params = (); type Result = (); - const METHOD: &'static str = "<unknown method>"; + const MESSAGE_DIRECTION: lsp_types::MessageDirection = + MessageDirection::ServerToClient; + const METHOD: LspRequestMethod<'static> = + LspRequestMethod::Custom("<unknown method>"); } #[derive(Debug)] pub struct LSPError {} @@ -158,11 +163,11 @@ impl<T: Clone, R, D, E> Clone for Rq<T, R, D, E> { } } #[derive(serde_derive::Serialize, serde_derive::Deserialize)] -pub struct Rq<T, R, D = (), E = RequestError<R>> { +pub struct Rq<Output, Res, Data = (), Error = LSPError> { #[serde(skip_serializing_if = "Option::is_none", default = "none")] - pub result: Option<T>, + pub result: Option<Output>, #[serde(skip, default = "none")] - pub request: Option<(AbortOnDropHandle<Result<R, E>>, D)>, + pub request: Option<(AbortOnDropHandle<Result<Res, Error>>, Data)>, } impl<T: Debug, R, D: Debug, E> Debug for Rq<T, R, D, E> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { |