use async_trait::async_trait;
use crate::lsp::client::LspError;
use crate::lsp::protocol::{JsonRpcNotification, JsonRpcRequest, JsonRpcResponse};
#[async_trait]
#[cfg_attr(test, mockall::automock)]
pub trait LspClientTrait: Send + Sync {
fn is_initialized(&self) -> bool;
async fn initialize(
&mut self,
root_uri: Option<String>,
) -> Result<lsp_types::InitializeResult, LspError>;
async fn shutdown(&mut self) -> Result<(), LspError>;
async fn close(&mut self) -> Result<(), LspError>;
async fn register_notification_handler<F>(&self, handler: F)
where
F: Fn(JsonRpcNotification) + Send + Sync + 'static;
async fn register_request_handler<F>(&self, handler: F)
where
F: Fn(JsonRpcRequest) -> JsonRpcResponse + Send + Sync + 'static;
async fn open_text_document(
&mut self,
uri: lsp_types::Uri,
language_id: String,
version: i32,
text: String,
) -> Result<(), LspError>;
async fn close_text_document(&mut self, uri: lsp_types::Uri) -> Result<(), LspError>;
async fn change_text_document(
&mut self,
uri: lsp_types::Uri,
version: i32,
text: String,
) -> Result<(), LspError>;
async fn workspace_symbols(
&mut self,
query: String,
) -> Result<Vec<lsp_types::WorkspaceSymbol>, LspError>;
#[allow(dead_code)]
async fn text_document_definition(
&mut self,
uri: lsp_types::Uri,
position: lsp_types::Position,
) -> Result<lsp_types::GotoDefinitionResponse, LspError>;
#[allow(dead_code)]
async fn text_document_declaration(
&mut self,
uri: lsp_types::Uri,
position: lsp_types::Position,
) -> Result<lsp_types::request::GotoDeclarationResponse, LspError>;
#[allow(dead_code)]
async fn text_document_references(
&mut self,
uri: lsp_types::Uri,
position: lsp_types::Position,
include_declaration: bool,
) -> Result<Vec<lsp_types::Location>, LspError>;
#[allow(dead_code)]
async fn text_document_hover(
&mut self,
uri: lsp_types::Uri,
position: lsp_types::Position,
) -> Result<Option<lsp_types::Hover>, LspError>;
async fn text_document_document_symbol(
&mut self,
uri: lsp_types::Uri,
) -> Result<lsp_types::DocumentSymbolResponse, LspError>;
#[allow(dead_code)]
async fn text_document_prepare_call_hierarchy(
&mut self,
uri: lsp_types::Uri,
position: lsp_types::Position,
) -> Result<Vec<lsp_types::CallHierarchyItem>, LspError>;
#[allow(dead_code)]
async fn call_hierarchy_incoming_calls(
&mut self,
item: lsp_types::CallHierarchyItem,
) -> Result<Vec<lsp_types::CallHierarchyIncomingCall>, LspError>;
#[allow(dead_code)]
async fn call_hierarchy_outgoing_calls(
&mut self,
item: lsp_types::CallHierarchyItem,
) -> Result<Vec<lsp_types::CallHierarchyOutgoingCall>, LspError>;
#[allow(dead_code)]
async fn text_document_prepare_type_hierarchy(
&mut self,
uri: lsp_types::Uri,
position: lsp_types::Position,
) -> Result<Option<Vec<lsp_types::TypeHierarchyItem>>, LspError>;
#[allow(dead_code)]
async fn type_hierarchy_supertypes(
&mut self,
item: lsp_types::TypeHierarchyItem,
) -> Result<Option<Vec<lsp_types::TypeHierarchyItem>>, LspError>;
#[allow(dead_code)]
async fn type_hierarchy_subtypes(
&mut self,
item: lsp_types::TypeHierarchyItem,
) -> Result<Option<Vec<lsp_types::TypeHierarchyItem>>, LspError>;
}