diff --git a/src/formatting.rs b/src/formatting.rs index 4e5593c..e25ffe6 100644 --- a/src/formatting.rs +++ b/src/formatting.rs @@ -2,7 +2,8 @@ use serde::{Deserialize, Serialize}; use crate::{ DocumentSelector, DynamicRegistrationClientCapabilities, Range, TextDocumentIdentifier, - TextDocumentPositionParams, WorkDoneProgressParams, + TextDocumentPositionParams, TextDocumentRegistrationOptions, WorkDoneProgressOptions, + WorkDoneProgressParams, }; use std::collections::HashMap; @@ -11,6 +12,38 @@ pub type DocumentFormattingClientCapabilities = DynamicRegistrationClientCapabil pub type DocumentRangeFormattingClientCapabilities = DynamicRegistrationClientCapabilities; pub type DocumentOnTypeFormattingClientCapabilities = DynamicRegistrationClientCapabilities; +#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct DocumentFormattingOptions { + #[serde(flatten)] + pub work_done_progress_options: WorkDoneProgressOptions, +} + +#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct DocumentFormattingRegistrationOptions { + #[serde(flatten)] + pub text_document_registration_options: TextDocumentRegistrationOptions, + #[serde(flatten)] + pub document_formatting_options: DocumentFormattingOptions, +} + +#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct DocumentRangeFormattingOptions { + #[serde(flatten)] + pub work_done_progress_options: WorkDoneProgressOptions, +} + +#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct DocumentRangeFormattingRegistrationOptions { + #[serde(flatten)] + pub text_document_registration_options: TextDocumentRegistrationOptions, + #[serde(flatten)] + pub document_range_formatting_options: DocumentRangeFormattingOptions, +} + /// Format document on type options #[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] diff --git a/src/lib.rs b/src/lib.rs index e38fae2..8498be5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -238,7 +238,9 @@ 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, Hash)] +#[derive( + Debug, Eq, PartialEq, Ord, PartialOrd, Copy, Clone, Default, Deserialize, Serialize, Hash, +)] pub struct Position { /// Line position in a document (zero-based). pub line: u32, @@ -2150,20 +2152,6 @@ pub struct WorkDoneProgressOptions { pub work_done_progress: Option, } -#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct DocumentFormattingOptions { - #[serde(flatten)] - pub work_done_progress_options: WorkDoneProgressOptions, -} - -#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] -#[serde(rename_all = "camelCase")] -pub struct DocumentRangeFormattingOptions { - #[serde(flatten)] - pub work_done_progress_options: WorkDoneProgressOptions, -} - #[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)] #[serde(rename_all = "camelCase")] pub struct DefinitionOptions {