diff --git a/src/inlay_hint.rs b/src/inlay_hint.rs index e373706..5e0124a 100644 --- a/src/inlay_hint.rs +++ b/src/inlay_hint.rs @@ -11,15 +11,8 @@ use serde::{Deserialize, Serialize}; #[serde(rename_all = "camelCase")] #[serde(untagged)] pub enum InlayHintServerCapabilities { - Options(InlayHintOptions), - RegistrationOptions(InlayHintRegistrationOptions), -} - -#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct InlayHintClientCapabilitiesResolveSupport { - /// The properties that a client can resolve lazily. - pub properties: Vec, + Options(InlayHintOptions), + RegistrationOptions(InlayHintRegistrationOptions), } /// Inlay hint client capabilities. @@ -35,7 +28,7 @@ pub struct InlayHintClientCapabilities { /// Indicates which properties a client can resolve lazily on a inlay /// hint. #[serde(skip_serializing_if = "Option::is_none")] - pub resolve_support: Option, + pub resolve_support: Option, } /// Inlay hint options used during static registration. @@ -259,3 +252,26 @@ impl InlayHintKind { pub const PARAMETER: InlayHintKind = InlayHintKind(2); } } + +#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct InlayHintResolveClientCapabilities { + pub properties: Vec, +} + +/// Client workspace capabilities specific to inlay hints. +/// +/// @since 3.17.0 - proposed state +#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct InlayHintWorkspaceClientCapabilities { + /// Whether the client implementation supports a refresh request sent from + /// the server to the client. + /// + /// Note that this event is global and will force the client to refresh all + /// inlay hints currently shown. It should be used with absolute care and + /// is useful for situation where a server for example detects a project wide + /// change that requires such a calculation. + #[serde(skip_serializing_if = "Option::is_none")] + pub refresh_support: Option, +} diff --git a/src/lib.rs b/src/lib.rs index 4152262..3a70515 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1252,6 +1252,11 @@ pub struct WorkspaceClientCapabilities { /// since 3.16.0 #[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, } #[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] diff --git a/src/request.rs b/src/request.rs index 4ed014d..aa03be4 100644 --- a/src/request.rs +++ b/src/request.rs @@ -771,6 +771,36 @@ impl Request for MonikerRequest { const METHOD: &'static str = "textDocument/moniker"; } +#[cfg(feature = "proposed")] +pub enum InlayHintRequest {} + +#[cfg(feature = "proposed")] +impl Request for InlayHintRequest { + type Params = InlayHintParams; + type Result = Option>; + const METHOD: &'static str = "textDocument/inlayHint"; +} + +#[cfg(feature = "proposed")] +pub enum InlayHintResolveRequest {} + +#[cfg(feature = "proposed")] +impl Request for InlayHintResolveRequest { + type Params = InlayHint; + type Result = InlayHint; + const METHOD: &'static str = "inlayHint/resolve"; +} + +#[cfg(feature = "proposed")] +pub enum InlayHintRefreshRequest {} + +#[cfg(feature = "proposed")] +impl Request for InlayHintRefreshRequest { + type Params = (); + type Result = (); + const METHOD: &'static str = "workspace/inlayHint/refresh"; +} + #[cfg(test)] mod test { use super::*;