use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(description = "Parameters for getting hover information at a position in a file.")]
pub struct HoverParams {
#[schemars(description = "Absolute path to the file.")]
pub file_path: String,
#[schemars(description = "Line number (1-based).")]
pub line: u32,
#[schemars(description = "Character/column number (1-based).")]
pub character: u32,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(description = "Parameters for getting the definition location of a symbol.")]
pub struct DefinitionParams {
#[schemars(description = "Absolute path to the file.")]
pub file_path: String,
#[schemars(description = "Line number (1-based).")]
pub line: u32,
#[schemars(description = "Character/column number (1-based).")]
pub character: u32,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(description = "Parameters for finding all references to a symbol.")]
pub struct ReferencesParams {
#[schemars(description = "Absolute path to the file.")]
pub file_path: String,
#[schemars(description = "Line number (1-based).")]
pub line: u32,
#[schemars(description = "Character/column number (1-based).")]
pub character: u32,
#[schemars(description = "Whether to include the declaration in the results.")]
#[serde(default)]
pub include_declaration: bool,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(description = "Parameters for getting diagnostics (errors, warnings) for a file.")]
pub struct DiagnosticsParams {
#[schemars(description = "Absolute path to the file.")]
pub file_path: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(description = "Parameters for renaming a symbol across the workspace.")]
pub struct RenameParams {
#[schemars(description = "Absolute path to the file.")]
pub file_path: String,
#[schemars(description = "Line number (1-based).")]
pub line: u32,
#[schemars(description = "Character/column number (1-based).")]
pub character: u32,
#[schemars(description = "New name for the symbol.")]
pub new_name: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(description = "Parameters for getting code completion suggestions.")]
pub struct CompletionsParams {
#[schemars(description = "Absolute path to the file.")]
pub file_path: String,
#[schemars(description = "Line number (1-based).")]
pub line: u32,
#[schemars(description = "Character/column number (1-based).")]
pub character: u32,
#[schemars(description = "Optional trigger character (e.g., '.', ':', '->').")]
pub trigger: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(description = "Parameters for getting all symbols in a document.")]
pub struct DocumentSymbolsParams {
#[schemars(description = "Absolute path to the file.")]
pub file_path: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(description = "Parameters for formatting a document.")]
pub struct FormatDocumentParams {
#[schemars(description = "Absolute path to the file.")]
pub file_path: String,
#[schemars(description = "Tab size for formatting (default: 4).")]
#[serde(default = "default_tab_size")]
pub tab_size: u32,
#[schemars(description = "Whether to use spaces instead of tabs (default: true).")]
#[serde(default = "default_insert_spaces")]
pub insert_spaces: bool,
}
const fn default_tab_size() -> u32 {
4
}
const fn default_insert_spaces() -> bool {
true
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(description = "Parameters for searching symbols across the workspace.")]
pub struct WorkspaceSymbolParams {
#[schemars(description = "Search query for symbol names (supports partial matching).")]
pub query: String,
#[schemars(description = "Optional filter by symbol kind (function, class, variable, etc.).")]
#[serde(skip_serializing_if = "Option::is_none")]
pub kind_filter: Option<String>,
#[schemars(description = "Maximum results to return (default: 100).")]
#[serde(default = "default_max_results")]
pub limit: u32,
}
const fn default_max_results() -> u32 {
100
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(
description = "Parameters for getting available code actions (quick fixes, refactorings) for a range."
)]
pub struct CodeActionsParams {
#[schemars(description = "Absolute path to the file.")]
pub file_path: String,
#[schemars(description = "Start line (1-based).")]
pub start_line: u32,
#[schemars(description = "Start character (1-based).")]
pub start_character: u32,
#[schemars(description = "End line (1-based).")]
pub end_line: u32,
#[schemars(description = "End character (1-based).")]
pub end_character: u32,
#[schemars(description = "Optional filter by action kind (quickfix, refactor, source, etc.).")]
#[serde(skip_serializing_if = "Option::is_none")]
pub kind_filter: Option<String>,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(description = "Parameters for preparing call hierarchy at a position.")]
pub struct CallHierarchyPrepareParams {
#[schemars(description = "Absolute path to the file.")]
pub file_path: String,
#[schemars(description = "Line number (1-based).")]
pub line: u32,
#[schemars(description = "Character/column number (1-based).")]
pub character: u32,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(
description = "Parameters for getting incoming or outgoing calls for a call hierarchy item."
)]
pub struct CallHierarchyCallsParams {
#[schemars(description = "The call hierarchy item to get calls for (from prepare response).")]
pub item: serde_json::Value,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(
description = "Parameters for getting cached diagnostics from LSP server notifications."
)]
pub struct CachedDiagnosticsParams {
#[schemars(description = "Absolute path to the file.")]
pub file_path: String,
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(description = "Parameters for getting recent LSP server log messages.")]
pub struct ServerLogsParams {
#[schemars(description = "Maximum number of log entries to return (default: 50).")]
#[serde(default = "default_log_limit")]
pub limit: usize,
#[schemars(description = "Minimum log level to include: error, warning, info, debug.")]
#[serde(skip_serializing_if = "Option::is_none")]
pub min_level: Option<String>,
}
const fn default_log_limit() -> usize {
50
}
#[derive(Debug, Clone, Serialize, Deserialize, JsonSchema)]
#[schemars(
description = "Parameters for getting recent LSP server messages (showMessage notifications)."
)]
pub struct ServerMessagesParams {
#[schemars(description = "Maximum number of messages to return (default: 20).")]
#[serde(default = "default_message_limit")]
pub limit: usize,
}
const fn default_message_limit() -> usize {
20
}