| 1 | use serde::{Deserialize, Serialize}; |
| 2 | use url::Url; |
| 3 | |
| 4 | use crate::OneOf; |
| 5 | |
| 6 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 7 | #[serde(rename_all = "camelCase" )] |
| 8 | pub struct WorkspaceFoldersServerCapabilities { |
| 9 | /// The server has support for workspace folders |
| 10 | #[serde(skip_serializing_if = "Option::is_none" )] |
| 11 | pub supported: Option<bool>, |
| 12 | |
| 13 | /// Whether the server wants to receive workspace folder |
| 14 | /// change notifications. |
| 15 | /// |
| 16 | /// If a string is provided, the string is treated as an ID |
| 17 | /// under which the notification is registered on the client |
| 18 | /// side. The ID can be used to unregister for these events |
| 19 | /// using the `client/unregisterCapability` request. |
| 20 | #[serde(skip_serializing_if = "Option::is_none" )] |
| 21 | pub change_notifications: Option<OneOf<bool, String>>, |
| 22 | } |
| 23 | |
| 24 | #[derive (Debug, Eq, PartialEq, Ord, PartialOrd, Clone, Deserialize, Serialize)] |
| 25 | #[serde(rename_all = "camelCase" )] |
| 26 | pub struct WorkspaceFolder { |
| 27 | /// The associated URI for this workspace folder. |
| 28 | pub uri: Url, |
| 29 | /// The name of the workspace folder. Defaults to the uri's basename. |
| 30 | pub name: String, |
| 31 | } |
| 32 | |
| 33 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 34 | #[serde(rename_all = "camelCase" )] |
| 35 | pub struct DidChangeWorkspaceFoldersParams { |
| 36 | /// The actual workspace folder change event. |
| 37 | pub event: WorkspaceFoldersChangeEvent, |
| 38 | } |
| 39 | |
| 40 | /// The workspace folder change event. |
| 41 | #[derive (Debug, Eq, PartialEq, Clone, Default, Deserialize, Serialize)] |
| 42 | #[serde(rename_all = "camelCase" )] |
| 43 | pub struct WorkspaceFoldersChangeEvent { |
| 44 | /// The array of added workspace folders |
| 45 | pub added: Vec<WorkspaceFolder>, |
| 46 | |
| 47 | /// The array of the removed workspace folders |
| 48 | pub removed: Vec<WorkspaceFolder>, |
| 49 | } |
| 50 | |