pub struct Translator { /* private fields */ }Expand description
Translator handles MCP tool calls by converting them to LSP requests.
Implementations§
Source§impl Translator
impl Translator
Sourcepub fn set_workspace_roots(&mut self, roots: Vec<PathBuf>)
pub fn set_workspace_roots(&mut self, roots: Vec<PathBuf>)
Set the workspace roots for path validation.
Sourcepub fn register_client(&mut self, language_id: String, client: LspClient)
pub fn register_client(&mut self, language_id: String, client: LspClient)
Register an LSP client for a language.
Sourcepub fn register_server(&mut self, language_id: String, server: LspServer)
pub fn register_server(&mut self, language_id: String, server: LspServer)
Register an LSP server for a language.
Sourcepub const fn document_tracker(&self) -> &DocumentTracker
pub const fn document_tracker(&self) -> &DocumentTracker
Get the document tracker.
Sourcepub const fn document_tracker_mut(&mut self) -> &mut DocumentTracker
pub const fn document_tracker_mut(&mut self) -> &mut DocumentTracker
Get a mutable reference to the document tracker.
Sourcepub const fn notification_cache(&self) -> &NotificationCache
pub const fn notification_cache(&self) -> &NotificationCache
Get the notification cache.
Sourcepub const fn notification_cache_mut(&mut self) -> &mut NotificationCache
pub const fn notification_cache_mut(&mut self) -> &mut NotificationCache
Get a mutable reference to the notification cache.
Source§impl Translator
impl Translator
Sourcepub async fn handle_hover(
&mut self,
file_path: String,
line: u32,
character: u32,
) -> Result<HoverResult>
pub async fn handle_hover( &mut self, file_path: String, line: u32, character: u32, ) -> Result<HoverResult>
Handle hover request.
§Errors
Returns an error if the LSP request fails or the file cannot be opened.
Sourcepub async fn handle_definition(
&mut self,
file_path: String,
line: u32,
character: u32,
) -> Result<DefinitionResult>
pub async fn handle_definition( &mut self, file_path: String, line: u32, character: u32, ) -> Result<DefinitionResult>
Handle definition request.
§Errors
Returns an error if the LSP request fails or the file cannot be opened.
Sourcepub async fn handle_references(
&mut self,
file_path: String,
line: u32,
character: u32,
include_declaration: bool,
) -> Result<ReferencesResult>
pub async fn handle_references( &mut self, file_path: String, line: u32, character: u32, include_declaration: bool, ) -> Result<ReferencesResult>
Handle references request.
§Errors
Returns an error if the LSP request fails or the file cannot be opened.
Sourcepub async fn handle_diagnostics(
&mut self,
file_path: String,
) -> Result<DiagnosticsResult>
pub async fn handle_diagnostics( &mut self, file_path: String, ) -> Result<DiagnosticsResult>
Handle diagnostics request.
§Errors
Returns an error if the LSP request fails or the file cannot be opened.
Sourcepub async fn handle_rename(
&mut self,
file_path: String,
line: u32,
character: u32,
new_name: String,
) -> Result<RenameResult>
pub async fn handle_rename( &mut self, file_path: String, line: u32, character: u32, new_name: String, ) -> Result<RenameResult>
Handle rename request.
§Errors
Returns an error if the LSP request fails or the file cannot be opened.
Sourcepub async fn handle_completions(
&mut self,
file_path: String,
line: u32,
character: u32,
trigger: Option<String>,
) -> Result<CompletionsResult>
pub async fn handle_completions( &mut self, file_path: String, line: u32, character: u32, trigger: Option<String>, ) -> Result<CompletionsResult>
Handle completions request.
§Errors
Returns an error if the LSP request fails or the file cannot be opened.
Sourcepub async fn handle_document_symbols(
&mut self,
file_path: String,
) -> Result<DocumentSymbolsResult>
pub async fn handle_document_symbols( &mut self, file_path: String, ) -> Result<DocumentSymbolsResult>
Handle document symbols request.
§Errors
Returns an error if the LSP request fails or the file cannot be opened.
Sourcepub async fn handle_format_document(
&mut self,
file_path: String,
tab_size: u32,
insert_spaces: bool,
) -> Result<FormatDocumentResult>
pub async fn handle_format_document( &mut self, file_path: String, tab_size: u32, insert_spaces: bool, ) -> Result<FormatDocumentResult>
Handle format document request.
§Errors
Returns an error if the LSP request fails or the file cannot be opened.
Sourcepub async fn handle_workspace_symbol(
&mut self,
query: String,
kind_filter: Option<String>,
limit: u32,
) -> Result<WorkspaceSymbolResult>
pub async fn handle_workspace_symbol( &mut self, query: String, kind_filter: Option<String>, limit: u32, ) -> Result<WorkspaceSymbolResult>
Handle workspace symbol search.
§Errors
Returns an error if the LSP request fails or no server is configured.
Sourcepub async fn handle_code_actions(
&mut self,
file_path: String,
start_line: u32,
start_character: u32,
end_line: u32,
end_character: u32,
kind_filter: Option<String>,
) -> Result<CodeActionsResult>
pub async fn handle_code_actions( &mut self, file_path: String, start_line: u32, start_character: u32, end_line: u32, end_character: u32, kind_filter: Option<String>, ) -> Result<CodeActionsResult>
Handle code actions request.
§Errors
Returns an error if the LSP request fails or the file cannot be opened.
Sourcepub async fn handle_call_hierarchy_prepare(
&mut self,
file_path: String,
line: u32,
character: u32,
) -> Result<CallHierarchyPrepareResult>
pub async fn handle_call_hierarchy_prepare( &mut self, file_path: String, line: u32, character: u32, ) -> Result<CallHierarchyPrepareResult>
Handle call hierarchy prepare request.
§Errors
Returns an error if the LSP request fails or the file cannot be opened.
Sourcepub async fn handle_incoming_calls(
&mut self,
item: Value,
) -> Result<IncomingCallsResult>
pub async fn handle_incoming_calls( &mut self, item: Value, ) -> Result<IncomingCallsResult>
Handle incoming calls request.
§Errors
Returns an error if the LSP request fails or the item is invalid.
Sourcepub async fn handle_outgoing_calls(
&mut self,
item: Value,
) -> Result<OutgoingCallsResult>
pub async fn handle_outgoing_calls( &mut self, item: Value, ) -> Result<OutgoingCallsResult>
Handle outgoing calls request.
§Errors
Returns an error if the LSP request fails or the item is invalid.
Sourcepub fn handle_cached_diagnostics(
&mut self,
file_path: &str,
) -> Result<DiagnosticsResult>
pub fn handle_cached_diagnostics( &mut self, file_path: &str, ) -> Result<DiagnosticsResult>
Handle cached diagnostics request.
§Errors
Returns an error if the path is invalid or outside workspace boundaries.