Skip to main content

LspServerConfig

Trait LspServerConfig 

Source
pub trait LspServerConfig: Send + Sync {
    // Required methods
    fn server_name(&self) -> &str;
    fn binary_name(&self) -> &str;
    fn language_id(&self) -> &str;
    fn cached_binary_name(&self) -> String;
    fn download_url(&self) -> Option<String>;

    // Provided methods
    fn init_params_extra(&self, _root_uri: &str) -> Value { ... }
    fn post_init_delay_secs(&self) -> u64 { ... }
    fn spawn_args(&self) -> Vec<String> { ... }
    fn install_command(&self) -> Option<(String, Vec<String>)> { ... }
    fn setup_hints(&self) -> String { ... }
}
Expand description

Configuration for a language server binary.

Each supported language provides an implementation that knows how to locate/download the server binary and what parameters to send during LSP initialization.

Required Methods§

Source

fn server_name(&self) -> &str

Human-readable name for logging.

Source

fn binary_name(&self) -> &str

The binary name to look for on PATH (e.g. “rust-analyzer”, “pyright-langserver”).

Source

fn language_id(&self) -> &str

The LSP language ID for textDocument/didOpen (e.g. “rust”, “python”).

Source

fn cached_binary_name(&self) -> String

Cache directory relative filename for the downloaded binary (if applicable).

Source

fn download_url(&self) -> Option<String>

URL to download the binary from (if PATH lookup fails and download feature enabled).

Provided Methods§

Source

fn init_params_extra(&self, _root_uri: &str) -> Value

Extra initialization parameters to include in the LSP initialize request.

Source

fn post_init_delay_secs(&self) -> u64

Seconds to sleep after initialization to let the server index.

Source

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

Arguments to pass to the server binary when spawning.

Source

fn install_command(&self) -> Option<(String, Vec<String>)>

Optional command to install the server when not found on PATH or cache. Returns (command, args) — e.g. ("go", vec!["install", "golang.org/x/tools/gopls@v0.21.1"]). The locate_or_download logic will run this and then re-check PATH.

Source

fn setup_hints(&self) -> String

Human-readable setup/installation hints for this LSP server. Returns a description of how to install the server, for the agent to act on.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§