use std::collections::HashMap;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use url::Url;
use crate::Range;
#[derive(Eq, PartialEq, Clone, Copy, Deserialize, Serialize)]
#[serde(transparent)]
pub struct MessageType(i32);
lsp_enum! {
impl MessageType {
pub const ERROR: MessageType = MessageType(1);
pub const WARNING: MessageType = MessageType(2);
pub const INFO: MessageType = MessageType(3);
pub const LOG: MessageType = MessageType(4);
}
}
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct WindowClientCapabilities {
#[serde(skip_serializing_if = "Option::is_none")]
pub work_done_progress: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub show_message: Option<ShowMessageRequestClientCapabilities>,
#[serde(skip_serializing_if = "Option::is_none")]
pub show_document: Option<ShowDocumentClientCapabilities>,
}
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ShowMessageRequestClientCapabilities {
#[serde(skip_serializing_if = "Option::is_none")]
pub message_action_item: Option<MessageActionItemCapabilities>,
}
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct MessageActionItemCapabilities {
#[serde(skip_serializing_if = "Option::is_none")]
pub additional_properties_support: Option<bool>,
}
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct MessageActionItem {
pub title: String,
#[serde(flatten)]
pub properties: HashMap<String, MessageActionItemProperty>,
}
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
#[serde(untagged)]
pub enum MessageActionItemProperty {
String(String),
Boolean(bool),
Integer(i32),
Object(Value),
}
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
pub struct LogMessageParams {
#[serde(rename = "type")]
pub typ: MessageType,
pub message: String,
}
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
pub struct ShowMessageParams {
#[serde(rename = "type")]
pub typ: MessageType,
pub message: String,
}
#[derive(Debug, Eq, PartialEq, Clone, Deserialize, Serialize)]
pub struct ShowMessageRequestParams {
#[serde(rename = "type")]
pub typ: MessageType,
pub message: String,
#[serde(skip_serializing_if = "Option::is_none")]
pub actions: Option<Vec<MessageActionItem>>,
}
#[derive(Debug, PartialEq, Clone, Default, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ShowDocumentClientCapabilities {
pub support: bool,
}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ShowDocumentParams {
pub uri: Url,
#[serde(skip_serializing_if = "Option::is_none")]
pub external: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub take_focus: Option<bool>,
#[serde(skip_serializing_if = "Option::is_none")]
pub selection: Option<Range>,
}
#[derive(Debug, PartialEq, Clone, Deserialize, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ShowDocumentResult {
pub success: bool,
}