lsp_types/
workspace_folders.rs

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