use crate::lsp_types::*;
use async_trait::async_trait;
use serde_json::Value;
#[derive(Debug)]
pub struct ClientError(pub String);
impl std::fmt::Display for ClientError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "ClientError: {}", self.0)
}
}
impl std::error::Error for ClientError {}
#[async_trait]
pub trait LanguageClient: Send + Sync + 'static {
async fn show_message(&self, params: ShowMessageParams) {
let _ = params;
}
async fn show_message_request(
&self,
params: ShowMessageRequestParams,
) -> Result<Option<MessageActionItem>, ClientError> {
let _ = params;
Ok(None)
}
async fn log_message(&self, params: LogMessageParams) {
let _ = params;
}
async fn work_done_progress_create(
&self,
params: WorkDoneProgressCreateParams,
) -> Result<(), ClientError> {
let _ = params;
Ok(())
}
async fn show_document(
&self,
params: ShowDocumentParams,
) -> Result<ShowDocumentResult, ClientError> {
let _ = params;
Ok(ShowDocumentResult { success: false })
}
async fn telemetry_event(&self, params: Value) {
let _ = params;
}
async fn register_capability(&self, params: RegistrationParams) -> Result<(), ClientError> {
let _ = params;
Ok(())
}
async fn unregister_capability(&self, params: UnregistrationParams) -> Result<(), ClientError> {
let _ = params;
Ok(())
}
async fn workspace_folders(&self) -> Result<Option<Vec<WorkspaceFolder>>, ClientError> {
Ok(None)
}
async fn configuration(&self, params: ConfigurationParams) -> Result<Vec<Value>, ClientError> {
let _ = params;
Ok(Vec::new())
}
async fn apply_edit(
&self,
params: ApplyWorkspaceEditParams,
) -> Result<ApplyWorkspaceEditResponse, ClientError> {
let _ = params;
Ok(ApplyWorkspaceEditResponse {
applied: false,
failure_reason: None,
failed_change: None,
})
}
async fn code_lens_refresh(&self) -> Result<(), ClientError> {
Ok(())
}
async fn semantic_tokens_refresh(&self) -> Result<(), ClientError> {
Ok(())
}
async fn inlay_hint_refresh(&self) -> Result<(), ClientError> {
Ok(())
}
async fn inline_value_refresh(&self) -> Result<(), ClientError> {
Ok(())
}
async fn workspace_diagnostic_refresh(&self) -> Result<(), ClientError> {
Ok(())
}
async fn publish_diagnostics(&self, params: PublishDiagnosticsParams) {
let _ = params;
}
}