1 | use serde::{Deserialize, Serialize}; |
2 | |
3 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
4 | #[serde(rename_all = "camelCase" )] |
5 | pub struct WorkspaceFileOperationsClientCapabilities { |
6 | /// Whether the client supports dynamic registration for file |
7 | /// requests/notifications. |
8 | #[serde(skip_serializing_if = "Option::is_none" )] |
9 | pub dynamic_registration: Option<bool>, |
10 | |
11 | /// The client has support for sending didCreateFiles notifications. |
12 | #[serde(skip_serializing_if = "Option::is_none" )] |
13 | pub did_create: Option<bool>, |
14 | |
15 | /// The server is interested in receiving willCreateFiles requests. |
16 | #[serde(skip_serializing_if = "Option::is_none" )] |
17 | pub will_create: Option<bool>, |
18 | |
19 | /// The server is interested in receiving didRenameFiles requests. |
20 | #[serde(skip_serializing_if = "Option::is_none" )] |
21 | pub did_rename: Option<bool>, |
22 | |
23 | /// The server is interested in receiving willRenameFiles requests. |
24 | #[serde(skip_serializing_if = "Option::is_none" )] |
25 | pub will_rename: Option<bool>, |
26 | |
27 | /// The server is interested in receiving didDeleteFiles requests. |
28 | #[serde(skip_serializing_if = "Option::is_none" )] |
29 | pub did_delete: Option<bool>, |
30 | |
31 | /// The server is interested in receiving willDeleteFiles requests. |
32 | #[serde(skip_serializing_if = "Option::is_none" )] |
33 | pub will_delete: Option<bool>, |
34 | } |
35 | |
36 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
37 | #[serde(rename_all = "camelCase" )] |
38 | pub struct WorkspaceFileOperationsServerCapabilities { |
39 | /// The server is interested in receiving didCreateFiles |
40 | /// notifications. |
41 | #[serde(skip_serializing_if = "Option::is_none" )] |
42 | pub did_create: Option<FileOperationRegistrationOptions>, |
43 | |
44 | /// The server is interested in receiving willCreateFiles requests. |
45 | #[serde(skip_serializing_if = "Option::is_none" )] |
46 | pub will_create: Option<FileOperationRegistrationOptions>, |
47 | |
48 | /// The server is interested in receiving didRenameFiles |
49 | /// notifications. |
50 | #[serde(skip_serializing_if = "Option::is_none" )] |
51 | pub did_rename: Option<FileOperationRegistrationOptions>, |
52 | |
53 | /// The server is interested in receiving willRenameFiles requests. |
54 | #[serde(skip_serializing_if = "Option::is_none" )] |
55 | pub will_rename: Option<FileOperationRegistrationOptions>, |
56 | |
57 | /// The server is interested in receiving didDeleteFiles file |
58 | /// notifications. |
59 | #[serde(skip_serializing_if = "Option::is_none" )] |
60 | pub did_delete: Option<FileOperationRegistrationOptions>, |
61 | |
62 | /// The server is interested in receiving willDeleteFiles file |
63 | /// requests. |
64 | #[serde(skip_serializing_if = "Option::is_none" )] |
65 | pub will_delete: Option<FileOperationRegistrationOptions>, |
66 | } |
67 | |
68 | /// The options to register for file operations. |
69 | /// |
70 | /// @since 3.16.0 |
71 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
72 | #[serde(rename_all = "camelCase" )] |
73 | pub struct FileOperationRegistrationOptions { |
74 | /// The actual filters. |
75 | pub filters: Vec<FileOperationFilter>, |
76 | } |
77 | |
78 | /// A filter to describe in which file operation requests or notifications |
79 | /// the server is interested in. |
80 | /// |
81 | /// @since 3.16.0 |
82 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
83 | #[serde(rename_all = "camelCase" )] |
84 | pub struct FileOperationFilter { |
85 | /// A Uri like `file` or `untitled`. |
86 | pub scheme: Option<String>, |
87 | |
88 | /// The actual file operation pattern. |
89 | pub pattern: FileOperationPattern, |
90 | } |
91 | |
92 | /// A pattern kind describing if a glob pattern matches a file a folder or |
93 | /// both. |
94 | /// |
95 | /// @since 3.16.0 |
96 | #[derive (Debug, Eq, PartialEq, Deserialize, Serialize, Clone)] |
97 | #[serde(rename_all = "lowercase" )] |
98 | pub enum FileOperationPatternKind { |
99 | /// The pattern matches a file only. |
100 | File, |
101 | |
102 | /// The pattern matches a folder only. |
103 | Folder, |
104 | } |
105 | |
106 | /// Matching options for the file operation pattern. |
107 | /// |
108 | /// @since 3.16.0 |
109 | /// |
110 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
111 | #[serde(rename_all = "camelCase" )] |
112 | pub struct FileOperationPatternOptions { |
113 | /// The pattern should be matched ignoring casing. |
114 | #[serde(skip_serializing_if = "Option::is_none" )] |
115 | pub ignore_case: Option<bool>, |
116 | } |
117 | |
118 | /// A pattern to describe in which file operation requests or notifications |
119 | /// the server is interested in. |
120 | /// |
121 | /// @since 3.16.0 |
122 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
123 | #[serde(rename_all = "camelCase" )] |
124 | pub struct FileOperationPattern { |
125 | /// The glob pattern to match. Glob patterns can have the following syntax: |
126 | /// - `*` to match one or more characters in a path segment |
127 | /// - `?` to match on one character in a path segment |
128 | /// - `**` to match any number of path segments, including none |
129 | /// - `{}` to group conditions (e.g. `**/*.{ts,js}` matches all TypeScript |
130 | /// and JavaScript files) |
131 | /// - `[]` to declare a range of characters to match in a path segment |
132 | /// (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …) |
133 | /// - `[!...]` to negate a range of characters to match in a path segment |
134 | /// (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but |
135 | /// not `example.0`) |
136 | pub glob: String, |
137 | |
138 | /// Whether to match files or folders with this pattern. |
139 | /// |
140 | /// Matches both if undefined. |
141 | #[serde(skip_serializing_if = "Option::is_none" )] |
142 | pub matches: Option<FileOperationPatternKind>, |
143 | |
144 | /// Additional options used during matching. |
145 | #[serde(skip_serializing_if = "Option::is_none" )] |
146 | pub options: Option<FileOperationPatternOptions>, |
147 | } |
148 | |
149 | /// The parameters sent in notifications/requests for user-initiated creation |
150 | /// of files. |
151 | /// |
152 | /// @since 3.16.0 |
153 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
154 | #[serde(rename_all = "camelCase" )] |
155 | pub struct CreateFilesParams { |
156 | /// An array of all files/folders created in this operation. |
157 | pub files: Vec<FileCreate>, |
158 | } |
159 | /// Represents information on a file/folder create. |
160 | /// |
161 | /// @since 3.16.0 |
162 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
163 | #[serde(rename_all = "camelCase" )] |
164 | pub struct FileCreate { |
165 | /// A file:// URI for the location of the file/folder being created. |
166 | pub uri: String, |
167 | } |
168 | |
169 | /// The parameters sent in notifications/requests for user-initiated renames |
170 | /// of files. |
171 | /// |
172 | /// @since 3.16.0 |
173 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
174 | #[serde(rename_all = "camelCase" )] |
175 | pub struct RenameFilesParams { |
176 | /// An array of all files/folders renamed in this operation. When a folder |
177 | /// is renamed, only the folder will be included, and not its children. |
178 | pub files: Vec<FileRename>, |
179 | } |
180 | |
181 | /// Represents information on a file/folder rename. |
182 | /// |
183 | /// @since 3.16.0 |
184 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
185 | #[serde(rename_all = "camelCase" )] |
186 | pub struct FileRename { |
187 | /// A file:// URI for the original location of the file/folder being renamed. |
188 | pub old_uri: String, |
189 | |
190 | /// A file:// URI for the new location of the file/folder being renamed. |
191 | pub new_uri: String, |
192 | } |
193 | |
194 | /// The parameters sent in notifications/requests for user-initiated deletes |
195 | /// of files. |
196 | /// |
197 | /// @since 3.16.0 |
198 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
199 | #[serde(rename_all = "camelCase" )] |
200 | pub struct DeleteFilesParams { |
201 | /// An array of all files/folders deleted in this operation. |
202 | pub files: Vec<FileDelete>, |
203 | } |
204 | |
205 | /// Represents information on a file/folder delete. |
206 | /// |
207 | /// @since 3.16.0 |
208 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
209 | #[serde(rename_all = "camelCase" )] |
210 | pub struct FileDelete { |
211 | /// A file:// URI for the location of the file/folder being deleted. |
212 | pub uri: String, |
213 | } |
214 | |