lsp_types/
rename.rs
1use crate::{Range, TextDocumentPositionParams, WorkDoneProgressOptions, WorkDoneProgressParams};
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
5#[serde(rename_all = "camelCase")]
6pub struct RenameParams {
7 #[serde(flatten)]
9 pub text_document_position: TextDocumentPositionParams,
10
11 pub new_name: String,
15
16 #[serde(flatten)]
17 pub work_done_progress_params: WorkDoneProgressParams,
18}
19
20#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
21#[serde(rename_all = "camelCase")]
22pub struct RenameOptions {
23 #[serde(skip_serializing_if = "Option::is_none")]
25 pub prepare_provider: Option<bool>,
26
27 #[serde(flatten)]
28 pub work_done_progress_options: WorkDoneProgressOptions,
29}
30
31#[derive(Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)]
32#[serde(rename_all = "camelCase")]
33pub struct RenameClientCapabilities {
34 #[serde(skip_serializing_if = "Option::is_none")]
36 pub dynamic_registration: Option<bool>,
37
38 #[serde(skip_serializing_if = "Option::is_none")]
42 pub prepare_support: Option<bool>,
43
44 #[serde(skip_serializing_if = "Option::is_none")]
51 pub prepare_support_default_behavior: Option<PrepareSupportDefaultBehavior>,
52
53 #[serde(skip_serializing_if = "Option::is_none")]
61 pub honors_change_annotations: Option<bool>,
62}
63
64#[derive(Eq, PartialEq, Copy, Clone, Serialize, Deserialize)]
65#[serde(transparent)]
66pub struct PrepareSupportDefaultBehavior(i32);
67lsp_enum! {
68impl PrepareSupportDefaultBehavior {
69 pub const IDENTIFIER: PrepareSupportDefaultBehavior = PrepareSupportDefaultBehavior(1);
72}
73}
74
75#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
76#[serde(untagged)]
77#[serde(rename_all = "camelCase")]
78pub enum PrepareRenameResponse {
79 Range(Range),
80 RangeWithPlaceholder {
81 range: Range,
82 placeholder: String,
83 },
84 #[serde(rename_all = "camelCase")]
85 DefaultBehavior {
86 default_behavior: bool,
87 },
88}