Debian Codegraph @

helix-lsp-types/src/rename.rs

raw symbols SCIP
1 use crate::{Range, TextDocumentPositionParams, WorkDoneProgressOptions, WorkDoneProgressParams};
2 use serde::{Deserialize, Serialize};
3
4 #[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
5 #[serde(rename_all = "camelCase")]
6 pub struct RenameParams {
7 /// Text Document and Position fields
8 #[serde(flatten)]
9 pub text_document_position: TextDocumentPositionParams,
10
11 /// The new name of the symbol. If the given name is not valid the
12 /// request must return a [ResponseError](#ResponseError) with an
13 /// appropriate message set.
14 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")]
22 pub struct RenameOptions {
23 /// Renames should be checked and tested before being executed.
24 #[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")]
33 pub struct RenameClientCapabilities {
34 /// Whether rename supports dynamic registration.
35 #[serde(skip_serializing_if = "Option::is_none")]
36 pub dynamic_registration: Option<bool>,
37
38 /// Client supports testing for validity of rename operations before execution.
39 ///
40 /// @since 3.12.0
41 #[serde(skip_serializing_if = "Option::is_none")]
42 pub prepare_support: Option<bool>,
43
44 /// Client supports the default behavior result.
45 ///
46 /// The value indicates the default behavior used by the
47 /// client.
48 ///
49 /// @since 3.16.0
50 #[serde(skip_serializing_if = "Option::is_none")]
51 pub prepare_support_default_behavior: Option<PrepareSupportDefaultBehavior>,
52
53 /// Whether the client honors the change annotations in
54 /// text edits and resource operations returned via the
55 /// rename request's workspace edit by for example presenting
56 /// the workspace edit in the user interface and asking
57 /// for confirmation.
58 ///
59 /// @since 3.16.0
60 #[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)]
66 pub struct PrepareSupportDefaultBehavior(i32);
67 lsp_enum! {
68 impl PrepareSupportDefaultBehavior {
69 /// The client's default behavior is to select the identifier
70 /// according the to language's syntax rule
71 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")]
78 pub 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 }