[−][src]Trait tower_lsp::LanguageServer
Trait implemented by language server backends.
This interface allows servers adhering to the Language Server Protocol to be implemented in a safe and easily testable way without exposing the low-level implementation details.
Required methods
fn initialize(
&self,
printer: &Printer,
params: InitializeParams
) -> Result<InitializeResult>
&self,
printer: &Printer,
params: InitializeParams
) -> Result<InitializeResult>
The initialize request is the first request sent from the client to the server.
fn shutdown<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Provided methods
fn initialized(&self, printer: &Printer, params: InitializedParams)
The initialized notification is sent from the client to the server after the client
received the result of the initialize request but before the client sends anything else.
The server can use the initialized notification for example to dynamically register
capabilities with the client.
fn did_change_workspace_folders(
&self,
p: &Printer,
params: DidChangeWorkspaceFoldersParams
)
&self,
p: &Printer,
params: DidChangeWorkspaceFoldersParams
)
The workspace/didChangeWorkspaceFolders notification is sent from the client to the
server to inform about workspace folder configuration changes.
The notification is sent by default if both of these boolean fields were set to true in
the initialize method:
InitializeParams::capabilities::workspace::workspace_foldersInitializeResult::capabilities::workspace::workspace_folders::supported
This notification is also sent if the server has registered itself to receive this notification.
fn did_change_configuration(
&self,
printer: &Printer,
params: DidChangeConfigurationParams
)
&self,
printer: &Printer,
params: DidChangeConfigurationParams
)
The workspace/didChangeConfiguration notification is sent from the client to the server
to signal the change of configuration settings.
fn did_change_watched_files(
&self,
printer: &Printer,
params: DidChangeWatchedFilesParams
)
&self,
printer: &Printer,
params: DidChangeWatchedFilesParams
)
The workspace/didChangeWatchedFiles notification is sent from the client to the server
when the client detects changes to files watched by the language client.
It is recommended that servers register for these file events using the registration
mechanism. This can be done here or in the initialized method using
Printer::register_capability().
fn symbol<'life0, 'async_trait>(
&'life0 self,
params: WorkspaceSymbolParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<SymbolInformation>>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self,
params: WorkspaceSymbolParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<SymbolInformation>>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
The workspace/symbol request is sent from the client to the server to list project-wide
symbols matching the given query string.
fn execute_command<'life0, 'life1, 'async_trait>(
&'life0 self,
p: &'life1 Printer,
params: ExecuteCommandParams
) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
&'life0 self,
p: &'life1 Printer,
params: ExecuteCommandParams
) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
The workspace/executeCommand request is sent from the client to the server to trigger
command execution on the server.
In most cases, the server creates a WorkspaceEdit structure and applies the changes to
the workspace using Printer::apply_edit() before returning from this function.
fn did_open(&self, printer: &Printer, params: DidOpenTextDocumentParams)
The textDocument/didOpen notification is sent from the client to the server to signal
that a new text document has been opened by the client.
The document's truth is now managed by the client and the server must not try to read the document’s truth using the document's URI. "Open" in this sense means it is managed by the client. It doesn't necessarily mean that its content is presented in an editor.
fn did_change(&self, printer: &Printer, params: DidChangeTextDocumentParams)
The textDocument/didChange notification is sent from the client to the server to signal
changes to a text document.
This notification will contain a distinct version tag and a list of edits made to the document for the server to interpret.
fn did_save(&self, printer: &Printer, params: DidSaveTextDocumentParams)
The textDocument/didSave notification is sent from the client to the server when the
document was saved in the client.
fn did_close(&self, printer: &Printer, params: DidCloseTextDocumentParams)
The textDocument/didClose notification is sent from the client to the server when the
document got closed in the client.
The document's truth now exists where the document's URI points to (e.g. if the document's URI is a file URI, the truth now exists on disk).
fn completion<'life0, 'async_trait>(
&'life0 self,
params: CompletionParams
) -> Pin<Box<dyn Future<Output = Result<Option<CompletionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self,
params: CompletionParams
) -> Pin<Box<dyn Future<Output = Result<Option<CompletionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
The textDocument/completion request is sent from the client to the server to compute
completion items at a given cursor position.
If computing full completion items is expensive, servers can additionally provide a handler
for the completion item resolve request (completionItem/resolve). This request is sent
when a completion item is selected in the user interface.
fn hover<'life0, 'async_trait>(
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<Hover>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<Hover>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
The textDocument/hover request asks the server for hover information at a given text
document position.
Such hover information typically includes type signature information and inline documentation for the symbol at the given text document position.
fn signature_help<'life0, 'async_trait>(
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<SignatureHelp>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<SignatureHelp>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
The textDocument/signatureHelp request is sent from the client to the server to request
signature information at a given cursor position.
fn goto_declaration<'life0, 'async_trait>(
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoDefinitionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoDefinitionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
The textDocument/declaration request asks the server for the declaration location of a
symbol at a given text document position.
The GotoDefinitionResponse::Link return value was introduced in specification version
3.14.0 and requires client-side support. It can be returned if the client set the following
field to true in the initialize method:
InitializeParams::capabilities::text_document::declaration::link_support
fn goto_definition<'life0, 'async_trait>(
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoDefinitionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoDefinitionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
The textDocument/definition request asks the server for the definition location of a
symbol at a given text document position.
The GotoDefinitionResponse::Link return value was introduced in specification version
3.14.0 and requires client-side support. It can be returned if the client set the following
field to true in the initialize method:
InitializeParams::capabilities::text_document::definition::link_support
fn goto_type_definition<'life0, 'async_trait>(
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoDefinitionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoDefinitionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
The textDocument/typeDefinition request asks the server for the type definition location of
a symbol at a given text document position.
The GotoDefinitionResponse::Link return value was introduced in specification version
3.14.0 and requires client-side support. It can be returned if the client set the following
field to true in the initialize method:
InitializeParams::capabilities::text_document::type_definition::link_support
fn goto_implementation<'life0, 'async_trait>(
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoImplementationResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoImplementationResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
The textDocument/implementation request is sent from the client to the server to resolve
the implementation location of a symbol at a given text document position.
The result type GotoImplementationResponse::Link got introduced with version 3.14.0 and
requires client-side support. It can be returned if the client set the following
field to true in the initialize method:
InitializeParams::capabilities::text_document::implementation::link_support
fn document_highlight<'life0, 'async_trait>(
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<DocumentHighlight>>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<DocumentHighlight>>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
The textDocument/documentHighlight request is sent from the client to the server to
resolve appropriate highlights for a given text document position.
For programming languages, this usually highlights all textual references to the symbol scoped to this file.
This request differs slightly from textDocument/references in that this one is allowed to
be more fuzzy.
Implementations on Foreign Types
impl<S: ?Sized + LanguageServer> LanguageServer for Box<S>[src]
fn initialize(
&self,
printer: &Printer,
params: InitializeParams
) -> Result<InitializeResult>[src]
&self,
printer: &Printer,
params: InitializeParams
) -> Result<InitializeResult>
fn initialized(&self, printer: &Printer, params: InitializedParams)[src]
fn shutdown<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn did_change_workspace_folders(
&self,
p: &Printer,
params: DidChangeWorkspaceFoldersParams
)[src]
&self,
p: &Printer,
params: DidChangeWorkspaceFoldersParams
)
fn did_change_configuration(
&self,
printer: &Printer,
params: DidChangeConfigurationParams
)[src]
&self,
printer: &Printer,
params: DidChangeConfigurationParams
)
fn did_change_watched_files(
&self,
printer: &Printer,
params: DidChangeWatchedFilesParams
)[src]
&self,
printer: &Printer,
params: DidChangeWatchedFilesParams
)
fn symbol<'life0, 'async_trait>(
&'life0 self,
params: WorkspaceSymbolParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<SymbolInformation>>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
params: WorkspaceSymbolParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<SymbolInformation>>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn execute_command<'life0, 'life1, 'async_trait>(
&'life0 self,
p: &'life1 Printer,
params: ExecuteCommandParams
) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
p: &'life1 Printer,
params: ExecuteCommandParams
) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>> where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn did_open(&self, printer: &Printer, params: DidOpenTextDocumentParams)[src]
fn did_change(&self, printer: &Printer, params: DidChangeTextDocumentParams)[src]
fn did_save(&self, printer: &Printer, params: DidSaveTextDocumentParams)[src]
fn did_close(&self, printer: &Printer, params: DidCloseTextDocumentParams)[src]
fn completion<'life0, 'async_trait>(
&'life0 self,
params: CompletionParams
) -> Pin<Box<dyn Future<Output = Result<Option<CompletionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
params: CompletionParams
) -> Pin<Box<dyn Future<Output = Result<Option<CompletionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn hover<'life0, 'async_trait>(
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<Hover>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<Hover>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn signature_help<'life0, 'async_trait>(
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<SignatureHelp>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<SignatureHelp>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn goto_declaration<'life0, 'async_trait>(
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoDefinitionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoDefinitionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn goto_definition<'life0, 'async_trait>(
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoDefinitionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoDefinitionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn goto_type_definition<'life0, 'async_trait>(
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoDefinitionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoDefinitionResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn goto_implementation<'life0, 'async_trait>(
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoImplementationResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoImplementationResponse>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn document_highlight<'life0, 'async_trait>(
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<DocumentHighlight>>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait, [src]
&'life0 self,
params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<DocumentHighlight>>>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,