From bd9bb2e74171b0194be51085c822c3ccbbb68b7b Mon Sep 17 00:00:00 2001 From: Carter Snook Date: Mon, 21 Mar 2022 10:42:58 -0500 Subject: [PATCH 1/2] feat(helperTypes): implement new JSON types --- src/inlay_hint.rs | 12 ++++++------ src/lib.rs | 22 ++++++++++++++++++++-- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/inlay_hint.rs b/src/inlay_hint.rs index 22f973a..c1482c9 100644 --- a/src/inlay_hint.rs +++ b/src/inlay_hint.rs @@ -1,7 +1,7 @@ #![cfg(feature = "proposed")] use crate::{ - Command, Location, MarkupContent, Position, Range, StaticRegistrationOptions, + Command, LSPAny, Location, MarkupContent, Position, Range, StaticRegistrationOptions, TextDocumentIdentifier, TextDocumentRegistrationOptions, TextEdit, WorkDoneProgressOptions, WorkDoneProgressParams, }; @@ -131,11 +131,11 @@ pub struct InlayHint { /// to visually align/separate an inlay hint. #[serde(skip_serializing_if = "Option::is_none")] pub padding_right: Option, - // FIXME(sno2): add [`data`] field after [`LSPAny`] is implemented - // /// A data entry field that is preserved on a inlay hint between - // /// a `textDocument/inlayHint` and a `inlayHint/resolve` request. - // #[serde(skip_serializing_if = "Option::is_none")] - // pub data: Option, + + /// A data entry field that is preserved on a inlay hint between + /// a `textDocument/inlayHint` and a `inlayHint/resolve` request. + #[serde(skip_serializing_if = "Option::is_none")] + pub data: Option, } #[derive(Debug, Clone, Deserialize, Serialize)] diff --git a/src/lib.rs b/src/lib.rs index 3a70515..7c3adaa 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -203,6 +203,24 @@ pub struct CancelParams { /* ----------------- Basic JSON Structures ----------------- */ +/// The LSP any type +/// +/// @since 3.17.0 +#[cfg(feature = "proposed")] +pub type LSPAny = serde_json::Value; + +/// LSP object definition. +/// +/// @since 3.17.0 +#[cfg(feature = "proposed")] +pub type LSPObject = serde_json::Map; + +/// LSP arrays. +/// +/// @since 3.17.0 +#[cfg(feature = "proposed")] +pub type LSPArray = Vec; + /// Position in a text document expressed as zero-based line and character offset. /// A position is between two characters like an 'insert' cursor in a editor. #[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Default, Deserialize, Serialize)] @@ -1255,8 +1273,8 @@ pub struct WorkspaceClientCapabilities { #[serde(skip_serializing_if = "Option::is_none")] - #[cfg(feature = "proposed")] - pub inlay_hint: Option, + #[cfg(feature = "proposed")] + pub inlay_hint: Option, } #[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] From c96b049dfd6f1667951da37a693fd2db7dbe1f70 Mon Sep 17 00:00:00 2001 From: Carter Snook Date: Mon, 21 Mar 2022 12:00:50 -0500 Subject: [PATCH 2/2] chore: fix formatting --- src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 7c3adaa..7b901ae 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1271,7 +1271,6 @@ pub struct WorkspaceClientCapabilities { #[serde(skip_serializing_if = "Option::is_none")] pub file_operations: Option, - #[serde(skip_serializing_if = "Option::is_none")] #[cfg(feature = "proposed")] pub inlay_hint: Option,