[][src]Trait tower_lsp::LanguageServer

pub trait LanguageServer: Send + Sync + 'static {
    type ShutdownFuture: Future<Item = (), Error = Error> + Send;
    type HighlightFuture: Future<Item = Option<Vec<DocumentHighlight>>, Error = Error> + Send;
    type HoverFuture: Future<Item = Option<Hover>, Error = Error> + Send;
    fn initialize(&self, params: InitializeParams) -> Result<InitializeResult>;
fn initialized(&self, printer: &Printer, params: InitializedParams);
fn shutdown(&self) -> Self::ShutdownFuture;
fn did_open(&self, printer: &Printer, params: DidOpenTextDocumentParams);
fn did_change(&self, printer: &Printer, params: DidChangeTextDocumentParams);
fn did_save(&self, printer: &Printer, params: DidSaveTextDocumentParams);
fn did_close(&self, printer: &Printer, params: DidCloseTextDocumentParams);
fn hover(&self, params: TextDocumentPositionParams) -> Self::HoverFuture;
fn highlight(
        &self,
        params: TextDocumentPositionParams
    ) -> Self::HighlightFuture; }

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.

Associated Types

type ShutdownFuture: Future<Item = (), Error = Error> + Send

Response returned when a server shutdown is requested.

type HighlightFuture: Future<Item = Option<Vec<DocumentHighlight>>, Error = Error> + Send

Response returned when a document highlight action is requested.

type HoverFuture: Future<Item = Option<Hover>, Error = Error> + Send

Response returned when a hover action is requested.

Loading content...

Required methods

fn initialize(&self, params: InitializeParams) -> Result<InitializeResult>

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

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 shutdown(&self) -> Self::ShutdownFuture

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.

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/didOpen] 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 hover(&self, params: TextDocumentPositionParams) -> Self::HoverFuture

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 highlight(&self, params: TextDocumentPositionParams) -> Self::HighlightFuture

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.

Loading content...

Implementations on Foreign Types

impl<S: ?Sized + LanguageServer> LanguageServer for Box<S>[src]

Loading content...

Implementors

Loading content...