Skip to content

Commit

Permalink
Merge pull request #233 from sno2/feat/jsonHelpers
Browse files Browse the repository at this point in the history
feat: implement json helpers
  • Loading branch information
Marwes authored Apr 7, 2022
2 parents 73d8796 + c96b049 commit 1caf44a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/inlay_hint.rs
Original file line number Diff line number Diff line change
@@ -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
23 changes: 20 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
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 @@ -1253,10 +1271,9 @@ pub struct WorkspaceClientCapabilities {
#[serde(skip_serializing_if = "Option::is_none")]
pub file_operations: Option<WorkspaceFileOperationsClientCapabilities>,


#[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 1caf44a

Please sign in to comment.