1use serde::{Deserialize, Serialize};
2
3use crate::{
4 DynamicRegistrationClientCapabilities, Range, StaticRegistrationOptions,
5 TextDocumentPositionParams, TextDocumentRegistrationOptions, WorkDoneProgressOptions,
6 WorkDoneProgressParams,
7};
8
9pub type LinkedEditingRangeClientCapabilities = DynamicRegistrationClientCapabilities;
10
11#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
12#[serde(rename_all = "camelCase")]
13pub struct LinkedEditingRangeOptions {
14 #[serde(flatten)]
15 pub work_done_progress_options: WorkDoneProgressOptions,
16}
17
18#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
19#[serde(rename_all = "camelCase")]
20pub struct LinkedEditingRangeRegistrationOptions {
21 #[serde(flatten)]
22 pub text_document_registration_options: TextDocumentRegistrationOptions,
23
24 #[serde(flatten)]
25 pub linked_editing_range_options: LinkedEditingRangeOptions,
26
27 #[serde(flatten)]
28 pub static_registration_options: StaticRegistrationOptions,
29}
30
31#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
32#[serde(untagged)]
33pub enum LinkedEditingRangeServerCapabilities {
34 Simple(bool),
35 Options(LinkedEditingRangeOptions),
36 RegistrationOptions(LinkedEditingRangeRegistrationOptions),
37}
38
39#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
40#[serde(rename_all = "camelCase")]
41pub struct LinkedEditingRangeParams {
42 #[serde(flatten)]
43 pub text_document_position_params: TextDocumentPositionParams,
44
45 #[serde(flatten)]
46 pub work_done_progress_params: WorkDoneProgressParams,
47}
48
49#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
50#[serde(rename_all = "camelCase")]
51pub struct LinkedEditingRanges {
52 /// A list of ranges that can be renamed together. The ranges must have
53 /// identical length and contain identical text content. The ranges cannot overlap.
54 pub ranges: Vec<Range>,
55
56 /// An optional word pattern (regular expression) that describes valid contents for
57 /// the given ranges. If no pattern is provided, the client configuration's word
58 /// pattern will be used.
59 #[serde(skip_serializing_if = "Option::is_none")]
60 pub word_pattern: Option<String>,
61}
62