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§
Sourcefn server_name(&self) -> &str
fn server_name(&self) -> &str
Human-readable name for logging.
Sourcefn binary_name(&self) -> &str
fn binary_name(&self) -> &str
The binary name to look for on PATH (e.g. “rust-analyzer”, “pyright-langserver”).
Sourcefn language_id(&self) -> &str
fn language_id(&self) -> &str
The LSP language ID for textDocument/didOpen (e.g. “rust”, “python”).
Sourcefn cached_binary_name(&self) -> String
fn cached_binary_name(&self) -> String
Cache directory relative filename for the downloaded binary (if applicable).
Sourcefn download_url(&self) -> Option<String>
fn download_url(&self) -> Option<String>
URL to download the binary from (if PATH lookup fails and download feature enabled).
Provided Methods§
Sourcefn init_params_extra(&self, _root_uri: &str) -> Value
fn init_params_extra(&self, _root_uri: &str) -> Value
Extra initialization parameters to include in the LSP initialize request.
Sourcefn post_init_delay_secs(&self) -> u64
fn post_init_delay_secs(&self) -> u64
Seconds to sleep after initialization to let the server index.
Sourcefn spawn_args(&self) -> Vec<String>
fn spawn_args(&self) -> Vec<String>
Arguments to pass to the server binary when spawning.
Sourcefn install_command(&self) -> Option<(String, Vec<String>)>
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.
Sourcefn setup_hints(&self) -> String
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".