[][src]Trait tower_lsp::LanguageServer

pub trait LanguageServer: Send + Sync + 'static {
#[must_use]    fn initialize<'life0, 'async_trait>(
        &'life0 self,
        params: InitializeParams
    ) -> Pin<Box<dyn Future<Output = Result<InitializeResult>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn shutdown<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; #[must_use] fn initialized<'life0, 'async_trait>(
        &'life0 self,
        params: InitializedParams
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn did_change_workspace_folders<'life0, 'async_trait>(
        &'life0 self,
        params: DidChangeWorkspaceFoldersParams
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn did_change_configuration<'life0, 'async_trait>(
        &'life0 self,
        params: DidChangeConfigurationParams
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn did_change_watched_files<'life0, 'async_trait>(
        &'life0 self,
        params: DidChangeWatchedFilesParams
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] 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
, { ... }
#[must_use] fn execute_command<'life0, 'async_trait>(
        &'life0 self,
        params: ExecuteCommandParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn did_open<'life0, 'async_trait>(
        &'life0 self,
        params: DidOpenTextDocumentParams
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn did_change<'life0, 'async_trait>(
        &'life0 self,
        params: DidChangeTextDocumentParams
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn will_save<'life0, 'async_trait>(
        &'life0 self,
        params: WillSaveTextDocumentParams
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn will_save_wait_until<'life0, 'async_trait>(
        &'life0 self,
        params: WillSaveTextDocumentParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<TextEdit>>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn did_save<'life0, 'async_trait>(
        &'life0 self,
        params: DidSaveTextDocumentParams
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn did_close<'life0, 'async_trait>(
        &'life0 self,
        params: DidCloseTextDocumentParams
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] 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
, { ... }
#[must_use] fn completion_resolve<'life0, 'async_trait>(
        &'life0 self,
        params: CompletionItem
    ) -> Pin<Box<dyn Future<Output = Result<CompletionItem>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn hover<'life0, 'async_trait>(
        &'life0 self,
        params: HoverParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<Hover>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn signature_help<'life0, 'async_trait>(
        &'life0 self,
        params: SignatureHelpParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<SignatureHelp>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn goto_declaration<'life0, 'async_trait>(
        &'life0 self,
        params: GotoDeclarationParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<GotoDeclarationResponse>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn goto_definition<'life0, 'async_trait>(
        &'life0 self,
        params: GotoDefinitionParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<GotoDefinitionResponse>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn goto_type_definition<'life0, 'async_trait>(
        &'life0 self,
        params: GotoTypeDefinitionParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<GotoTypeDefinitionResponse>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn goto_implementation<'life0, 'async_trait>(
        &'life0 self,
        params: GotoImplementationParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<GotoImplementationResponse>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn references<'life0, 'async_trait>(
        &'life0 self,
        params: ReferenceParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Location>>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn document_highlight<'life0, 'async_trait>(
        &'life0 self,
        params: DocumentHighlightParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<DocumentHighlight>>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn document_symbol<'life0, 'async_trait>(
        &'life0 self,
        params: DocumentSymbolParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<DocumentSymbolResponse>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn code_action<'life0, 'async_trait>(
        &'life0 self,
        params: CodeActionParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<CodeActionResponse>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn code_lens<'life0, 'async_trait>(
        &'life0 self,
        params: CodeLensParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<CodeLens>>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn code_lens_resolve<'life0, 'async_trait>(
        &'life0 self,
        params: CodeLens
    ) -> Pin<Box<dyn Future<Output = Result<CodeLens>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn document_link<'life0, 'async_trait>(
        &'life0 self,
        params: DocumentLinkParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<DocumentLink>>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn document_link_resolve<'life0, 'async_trait>(
        &'life0 self,
        params: DocumentLink
    ) -> Pin<Box<dyn Future<Output = Result<DocumentLink>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn document_color<'life0, 'async_trait>(
        &'life0 self,
        params: DocumentColorParams
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ColorInformation>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn color_presentation<'life0, 'async_trait>(
        &'life0 self,
        params: ColorPresentationParams
    ) -> Pin<Box<dyn Future<Output = Result<Vec<ColorPresentation>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn formatting<'life0, 'async_trait>(
        &'life0 self,
        params: DocumentFormattingParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<TextEdit>>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn range_formatting<'life0, 'async_trait>(
        &'life0 self,
        params: DocumentRangeFormattingParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<TextEdit>>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn on_type_formatting<'life0, 'async_trait>(
        &'life0 self,
        params: DocumentOnTypeFormattingParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<TextEdit>>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn rename<'life0, 'async_trait>(
        &'life0 self,
        params: RenameParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<WorkspaceEdit>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn prepare_rename<'life0, 'async_trait>(
        &'life0 self,
        params: TextDocumentPositionParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<PrepareRenameResponse>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn folding_range<'life0, 'async_trait>(
        &'life0 self,
        params: FoldingRangeParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<FoldingRange>>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... }
#[must_use] fn selection_range<'life0, 'async_trait>(
        &'life0 self,
        params: SelectionRangeParams
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<SelectionRange>>>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
, { ... } }

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

#[must_use]fn initialize<'life0, 'async_trait>(
    &'life0 self,
    params: InitializeParams
) -> Pin<Box<dyn Future<Output = Result<InitializeResult>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The initialize request is the first request sent from the client to the server.

This method is guaranteed to only execute once. If the client sends this request to the server again, the server will respond with JSON-RPC error code -32600 (invalid request).

#[must_use]fn shutdown<'life0, 'async_trait>(
    &'life0 self
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The shutdown request asks the server to gracefully shut down, but to not exit.

This request is often later followed by an exit notification, which will cause the server to exit immediately.

This method is guaranteed to only execute once. If the client sends this request to the server again, the server will respond with JSON-RPC error code -32600 (invalid request).

Loading content...

Provided methods

#[must_use]fn initialized<'life0, 'async_trait>(
    &'life0 self,
    params: InitializedParams
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

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.

#[must_use]fn did_change_workspace_folders<'life0, 'async_trait>(
    &'life0 self,
    params: DidChangeWorkspaceFoldersParams
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

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_folders
  • InitializeResult::capabilities::workspace::workspace_folders::supported

This notification is also sent if the server has registered itself to receive this notification.

#[must_use]fn did_change_configuration<'life0, 'async_trait>(
    &'life0 self,
    params: DidChangeConfigurationParams
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The workspace/didChangeConfiguration notification is sent from the client to the server to signal the change of configuration settings.

#[must_use]fn did_change_watched_files<'life0, 'async_trait>(
    &'life0 self,
    params: DidChangeWatchedFilesParams
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

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 Client::register_capability().

#[must_use]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, 

The workspace/symbol request is sent from the client to the server to list project-wide symbols matching the given query string.

#[must_use]fn execute_command<'life0, 'async_trait>(
    &'life0 self,
    params: ExecuteCommandParams
) -> Pin<Box<dyn Future<Output = Result<Option<Value>>> + Send + 'async_trait>> where
    'life0: '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 Client::apply_edit() before returning from this function.

#[must_use]fn did_open<'life0, 'async_trait>(
    &'life0 self,
    params: DidOpenTextDocumentParams
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

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.

#[must_use]fn did_change<'life0, 'async_trait>(
    &'life0 self,
    params: DidChangeTextDocumentParams
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

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.

#[must_use]fn will_save<'life0, 'async_trait>(
    &'life0 self,
    params: WillSaveTextDocumentParams
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The textDocument/willSave notification is sent from the client to the server before the document is actually saved.

#[must_use]fn will_save_wait_until<'life0, 'async_trait>(
    &'life0 self,
    params: WillSaveTextDocumentParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<TextEdit>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The [textDocument/willSaveWaitUntil] request is sent from the client to the server before the document is actually saved.

The request can return an array of TextEdits which will be applied to the text document before it is saved.

Please note that clients might drop results if computing the text edits took too long or if a server constantly fails on this request. This is done to keep the save fast and reliable.

#[must_use]fn did_save<'life0, 'async_trait>(
    &'life0 self,
    params: DidSaveTextDocumentParams
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The textDocument/didSave notification is sent from the client to the server when the document was saved in the client.

#[must_use]fn did_close<'life0, 'async_trait>(
    &'life0 self,
    params: DidCloseTextDocumentParams
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

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).

#[must_use]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, 

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.

#[must_use]fn completion_resolve<'life0, 'async_trait>(
    &'life0 self,
    params: CompletionItem
) -> Pin<Box<dyn Future<Output = Result<CompletionItem>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The completionItem/resolve request is sent from the client to the server to resolve additional information for a given completion item.

#[must_use]fn hover<'life0, 'async_trait>(
    &'life0 self,
    params: HoverParams
) -> 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.

#[must_use]fn signature_help<'life0, 'async_trait>(
    &'life0 self,
    params: SignatureHelpParams
) -> 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.

#[must_use]fn goto_declaration<'life0, 'async_trait>(
    &'life0 self,
    params: GotoDeclarationParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoDeclarationResponse>>> + 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.

Compatibility

This request was introduced in specification version 3.14.0.

The GotoDefinitionResponse::Link return value was introduced in specification version 3.14.0 and requires client-side support in order to be used. It can be returned if the client set the following field to true in the initialize method:

InitializeParams::capabilities::text_document::declaration::link_support

#[must_use]fn goto_definition<'life0, 'async_trait>(
    &'life0 self,
    params: GotoDefinitionParams
) -> 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.

Compatibility

The GotoDefinitionResponse::Link return value was introduced in specification version 3.14.0 and requires client-side support in order to be used. It can be returned if the client set the following field to true in the initialize method:

InitializeParams::capabilities::text_document::definition::link_support

#[must_use]fn goto_type_definition<'life0, 'async_trait>(
    &'life0 self,
    params: GotoTypeDefinitionParams
) -> Pin<Box<dyn Future<Output = Result<Option<GotoTypeDefinitionResponse>>> + 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.

Compatibility

This request was introduced in specification version 3.6.0.

The GotoDefinitionResponse::Link return value was introduced in specification version 3.14.0 and requires client-side support in order to be used. 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

#[must_use]fn goto_implementation<'life0, 'async_trait>(
    &'life0 self,
    params: GotoImplementationParams
) -> 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.

Compatibility

This request was introduced in specification version 3.6.0.

The GotoImplementationResponse::Link return value was introduced in specification version 3.14.0 and requires client-side support in order to be used. It can be returned if the client set the following field to true in the initialize method:

InitializeParams::capabilities::text_document::implementation::link_support

#[must_use]fn references<'life0, 'async_trait>(
    &'life0 self,
    params: ReferenceParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<Location>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The textDocument/references request is sent from the client to the server to resolve project-wide references for the symbol denoted by the given text document position.

#[must_use]fn document_highlight<'life0, 'async_trait>(
    &'life0 self,
    params: DocumentHighlightParams
) -> 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.

#[must_use]fn document_symbol<'life0, 'async_trait>(
    &'life0 self,
    params: DocumentSymbolParams
) -> Pin<Box<dyn Future<Output = Result<Option<DocumentSymbolResponse>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The textDocument/documentSymbol request is sent from the client to the server to retrieve all symbols found in a given text document.

The returned result is either:

  • DocumentSymbolResponse::Flat which is a flat list of all symbols found in a given text document. Then neither the symbol’s location range nor the symbol’s container name should be used to infer a hierarchy.
  • DocumentSymbolResponse::Nested which is a hierarchy of symbols found in a given text document.

#[must_use]fn code_action<'life0, 'async_trait>(
    &'life0 self,
    params: CodeActionParams
) -> Pin<Box<dyn Future<Output = Result<Option<CodeActionResponse>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The textDocument/codeAction request is sent from the client to the server to compute commands for a given text document and range. These commands are typically code fixes to either fix problems or to beautify/refactor code.

The result of a textDocument/codeAction request is an array of Command literals which are typically presented in the user interface.

To ensure that a server is useful in many clients, the commands specified in a code actions should be handled by the server and not by the client (see workspace/executeCommand and ServerCapabilities::execute_command_provider). If the client supports providing edits with a code action, then the mode should be used.

When the command is selected the server should be contacted again (via the workspace/executeCommand request) to execute the command.

Compatibility

Since version 3.8.0: support for CodeAction literals to enable the following scenarios:

  • The ability to directly return a workspace edit from the code action request. This avoids having another server roundtrip to execute an actual code action. However server providers should be aware that if the code action is expensive to compute or the edits are huge it might still be beneficial if the result is simply a command and the actual edit is only computed when needed.

  • The ability to group code actions using a kind. Clients are allowed to ignore that information. However it allows them to better group code action for example into corresponding menus (e.g. all refactor code actions into a refactor menu).

#[must_use]fn code_lens<'life0, 'async_trait>(
    &'life0 self,
    params: CodeLensParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<CodeLens>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The textDocument/codeLens request is sent from the client to the server to compute code lenses for a given text document.

#[must_use]fn code_lens_resolve<'life0, 'async_trait>(
    &'life0 self,
    params: CodeLens
) -> Pin<Box<dyn Future<Output = Result<CodeLens>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The codeLens/resolve request is sent from the client to the server to resolve the command for a given code lens item.

The textDocument/documentLink request is sent from the client to the server to request the location of links in a document.

A document link is a range in a text document that links to an internal or external resource, like another text document or a web site.

Compatibility

The DocumentLink::tooltip field was introduced in specification version 3.15.0 and requires client-side support in order to be used. It can be returned if the client set the following field to true in the initialize method:

InitializeParams::capabilities::text_document::document_link::tooltip_support

The documentLink/resolve request is sent from the client to the server to resolve the target of a given document link.

A document link is a range in a text document that links to an internal or external resource, like another text document or a web site.

#[must_use]fn document_color<'life0, 'async_trait>(
    &'life0 self,
    params: DocumentColorParams
) -> Pin<Box<dyn Future<Output = Result<Vec<ColorInformation>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The textDocument/documentColor request is sent from the client to the server to list all color references found in a given text document. Along with the range, a color value in RGB is returned.

Clients can use the result to decorate color references in an editor. For example:

  • Color boxes showing the actual color next to the reference
  • Show a color picker when a color reference is edited

Compatibility

This request was introduced in specification version 3.6.0.

#[must_use]fn color_presentation<'life0, 'async_trait>(
    &'life0 self,
    params: ColorPresentationParams
) -> Pin<Box<dyn Future<Output = Result<Vec<ColorPresentation>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The [textDocument/colorPresentation] request is sent from the client to the server to obtain a list of presentations for a color value at a given location.

Clients can use the result to:

  • Modify a color reference
  • Show in a color picker and let users pick one of the presentations

Compatibility

This request was introduced in specification version 3.6.0.

This request has no special capabilities and registration options since it is sent as a resolve request for the textDocument/documentColor request.

#[must_use]fn formatting<'life0, 'async_trait>(
    &'life0 self,
    params: DocumentFormattingParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<TextEdit>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The textDocument/formatting request is sent from the client to the server to format a whole document.

#[must_use]fn range_formatting<'life0, 'async_trait>(
    &'life0 self,
    params: DocumentRangeFormattingParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<TextEdit>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The textDocument/rangeFormatting request is sent from the client to the server to format a given range in a document.

#[must_use]fn on_type_formatting<'life0, 'async_trait>(
    &'life0 self,
    params: DocumentOnTypeFormattingParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<TextEdit>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The textDocument/onTypeFormatting request is sent from the client to the server to format parts of the document during typing.

#[must_use]fn rename<'life0, 'async_trait>(
    &'life0 self,
    params: RenameParams
) -> Pin<Box<dyn Future<Output = Result<Option<WorkspaceEdit>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The textDocument/rename request is sent from the client to the server to ask the server to compute a workspace change so that the client can perform a workspace-wide rename of a symbol.

#[must_use]fn prepare_rename<'life0, 'async_trait>(
    &'life0 self,
    params: TextDocumentPositionParams
) -> Pin<Box<dyn Future<Output = Result<Option<PrepareRenameResponse>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The textDocument/prepareRename request is sent from the client to the server to setup and test the validity of a rename operation at a given location.

Compatibility

This request was introduced in specification version 3.12.0.

#[must_use]fn folding_range<'life0, 'async_trait>(
    &'life0 self,
    params: FoldingRangeParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<FoldingRange>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The textDocument/foldingRange request is sent from the client to the server to return all folding ranges found in a given text document.

Compatibility

This request was introduced in specification version 3.10.0.

#[must_use]fn selection_range<'life0, 'async_trait>(
    &'life0 self,
    params: SelectionRangeParams
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<SelectionRange>>>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 

The textDocument/selectionRange request is sent from the client to the server to return suggested selection ranges at an array of given positions. A selection range is a range around the cursor position which the user might be interested in selecting.

A selection range in the return array is for the position in the provided parameters at the same index. Therefore params.positions[i] must be contained in result[i].range.

Compatibility

This request was introduced in specification version 3.15.0.

Loading content...

Implementations on Foreign Types

impl<T: LanguageServer + ?Sized> LanguageServer for Arc<T> where
    Arc<T>: Send + Sync + 'static, 
[src]

impl<T: LanguageServer + ?Sized> LanguageServer for Box<T> where
    Box<T>: Send + Sync + 'static, 
[src]

Loading content...

Implementors

Loading content...