Skip to content

Commit

Permalink
feat(helperTypes): implement new JSON types
Browse files Browse the repository at this point in the history
  • Loading branch information
sno2 committed Mar 21, 2022
1 parent 2830389 commit bd9bb2e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 8 deletions.
12 changes: 6 additions & 6 deletions 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,
};
Expand Down Expand Up @@ -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<bool>,
// 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<crate::LSPAny>,

/// 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<LSPAny>,
}

#[derive(Debug, Clone, Deserialize, Serialize)]
Expand Down
22 changes: 20 additions & 2 deletions src/lib.rs
Expand Up @@ -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<String, serde_json::Value>;

/// LSP arrays.
///
/// @since 3.17.0
#[cfg(feature = "proposed")]
pub type LSPArray = Vec<serde_json::Value>;

/// 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)]
Expand Down Expand Up @@ -1255,8 +1273,8 @@ pub struct WorkspaceClientCapabilities {


#[serde(skip_serializing_if = "Option::is_none")]
#[cfg(feature = "proposed")]
pub inlay_hint: Option<InlayHintWorkspaceClientCapabilities>,
#[cfg(feature = "proposed")]
pub inlay_hint: Option<InlayHintWorkspaceClientCapabilities>,
}

#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
Expand Down

0 comments on commit bd9bb2e

Please sign in to comment.