Skip to main content

LspClient

Trait LspClient 

Source
pub trait LspClient: Send + Sync {
    // Required methods
    fn initialize<'life0, 'async_trait>(
        &'life0 self,
        root_uri: String,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<LspCapabilities>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn shutdown<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn open_document<'life0, 'async_trait>(
        &'life0 self,
        uri: String,
        language_id: String,
        content: String,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn close_document<'life0, 'async_trait>(
        &'life0 self,
        uri: String,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn change_document<'life0, 'async_trait>(
        &'life0 self,
        uri: String,
        changes: Vec<TextChange>,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn save_document<'life0, 'async_trait>(
        &'life0 self,
        uri: String,
    ) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn is_ready(&self) -> bool;
    fn supported_languages(&self) -> Vec<String>;
}
Expand description

LSP 客户端 trait

与 Language Server 通信的接口。

Required Methods§

Source

fn initialize<'life0, 'async_trait>( &'life0 self, root_uri: String, ) -> Pin<Box<dyn Future<Output = Layer3Result<LspCapabilities>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

初始化连接

Source

fn shutdown<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

关闭连接

Source

fn open_document<'life0, 'async_trait>( &'life0 self, uri: String, language_id: String, content: String, ) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

打开文档

Source

fn close_document<'life0, 'async_trait>( &'life0 self, uri: String, ) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

关闭文档

Source

fn change_document<'life0, 'async_trait>( &'life0 self, uri: String, changes: Vec<TextChange>, ) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

更新文档内容

Source

fn save_document<'life0, 'async_trait>( &'life0 self, uri: String, ) -> Pin<Box<dyn Future<Output = Layer3Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

保存文档

Source

fn is_ready(&self) -> bool

检查是否就绪

Source

fn supported_languages(&self) -> Vec<String>

获取支持的语言

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§