#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ExitedError(());
impl std::error::Error for ExitedError {}
impl std::fmt::Display for ExitedError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
f.write_str("language server has exited")
}
}
#[derive(Debug, thiserror::Error)]
pub enum LspClientError {
#[error("Failed to send message")]
SendFailed(
#[from] async_channel::SendError<crate::protocol::jsonrpc::Message>,
),
#[error("Failed to receive response")]
ReceiveFailed(#[from] async_channel::RecvError),
#[error("Failed to serialize params: {0}")]
SerializationFailed(#[from] serde_json::Error),
#[error("Failed to deserialize result")]
DeserializationFailed(serde_json::Error),
#[error("Server not initialized (-32002)")]
NotInitialized,
#[error("JSON-RPC error {code}: {message}")]
JsonRpcError { code: i64, message: String },
#[error("Invalid response: no result or error")]
InvalidResponse,
#[error("Connection closed")]
ConnectionClosed,
#[error("Request timed out after {0:?}")]
Timeout(std::time::Duration),
}