Skip to main content

Lsp

Trait Lsp 

Source
pub trait Lsp: Sized {
    type Fork: LspFork;

    // Required methods
    fn new(params: InitializeParams) -> Fallible<Self>;
    fn server_capabilities(&mut self) -> Fallible<ServerCapabilities>;
    fn server_info(&mut self) -> Fallible<Option<ServerInfo>>;
    fn fork(&mut self) -> Self::Fork;
    fn did_open(
        &mut self,
        editor: &mut dyn Editor<Self>,
        item: DidOpenTextDocumentParams,
    ) -> Fallible<()>;
    fn did_change(
        &mut self,
        editor: &mut dyn Editor<Self>,
        item: DidChangeTextDocumentParams,
    ) -> Fallible<()>;
    fn hover(
        &mut self,
        editor: &mut dyn Editor<Self>,
        params: HoverParams,
    ) -> Fallible<Option<Hover>>;

    // Provided method
    fn run() -> Fallible<()> { ... }
}
Expand description

LSP server handlers.

Required Associated Types§

Source

type Fork: LspFork

The server is “forked” to handle incoming “read” requests (e.g., goto-def). “Read” requests are requests that do not modify document state.

Required Methods§

Source

fn new(params: InitializeParams) -> Fallible<Self>

Source

fn server_capabilities(&mut self) -> Fallible<ServerCapabilities>

Capabilities to report to the editor.

Source

fn server_info(&mut self) -> Fallible<Option<ServerInfo>>

Server info to report to the editor.

Source

fn fork(&mut self) -> Self::Fork

Create a “fork” of the LSP server that can be used from another thread.

Source

fn did_open( &mut self, editor: &mut dyn Editor<Self>, item: DidOpenTextDocumentParams, ) -> Fallible<()>

Open reported for the given URI.

Source

fn did_change( &mut self, editor: &mut dyn Editor<Self>, item: DidChangeTextDocumentParams, ) -> Fallible<()>

Modification reported to the given URI.

Source

fn hover( &mut self, editor: &mut dyn Editor<Self>, params: HoverParams, ) -> Fallible<Option<Hover>>

Handle hover requests.

Provided Methods§

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§