pub struct ServerConfig {
pub id: String,
pub binary: PathBuf,
pub args: Vec<OsString>,
pub env: HashMap<String, String>,
pub root_markers: Vec<String>,
pub initialization_options: Option<Value>,
pub file_patterns: Vec<String>,
pub language_id: String,
}Expand description
Configuration for one language server. Captured at registry time; immutable after spawn.
Fields§
§id: StringStable identifier used in logs / telemetry / reference
counting. Convention: language id (e.g. "rust",
"python"); a workspace can host multiple actors with
the same id if they target different roots.
binary: PathBufPath to the server binary. Relative paths resolve via
PATH. Tilde expansion and env-var substitution are NOT
done here – the registry layer applies them when
loading from lsp.toml so the runtime sees a literal
path.
args: Vec<OsString>Arguments passed verbatim. rust-analyzer takes none;
pyright wants --stdio; gopls is configured via init
options.
env: HashMap<String, String>Extra environment variables for the spawned process.
Useful for RUST_LOG=info or PYTHONPATH=....
root_markers: Vec<String>Workspace-root markers. The supervisor walks up from the
opened buffer’s path looking for any of these; the first
hit becomes the server’s rootUri. Empty list falls back
to the buffer’s directory.
initialization_options: Option<Value>Server-specific initialization options. Sent verbatim as
initialize.params.initializationOptions. rust-analyzer
uses this to toggle cargo check on save, pyright for
venv discovery, etc.
file_patterns: Vec<String>File-pattern globs this server handles. The supervisor
matches a buffer’s path against these to decide which
server (if any) to attach. Multiple patterns are OR’d.
Example: ["*.rs", "*.toml"] for rust-analyzer to also
see Cargo manifests.
language_id: StringLSP language identifier sent in didOpen.textDocument.languageId.
Distinct from id because some servers (denols, vtsls)
handle multiple language ids; the registry can have one
ServerConfig per pattern with distinct language_id
values and the same id (so the actor is shared).
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn new(
id: impl Into<String>,
binary: impl Into<PathBuf>,
language_id: impl Into<String>,
) -> Self
pub fn new( id: impl Into<String>, binary: impl Into<PathBuf>, language_id: impl Into<String>, ) -> Self
Build a minimal config – intended for tests and as a starting point for the curated registry below.
Sourcepub fn with_args<I, S>(self, args: I) -> Self
pub fn with_args<I, S>(self, args: I) -> Self
Builder helper – one-line .with_args(["--stdio"]).
Sourcepub fn with_env(self, key: impl Into<String>, value: impl Into<String>) -> Self
pub fn with_env(self, key: impl Into<String>, value: impl Into<String>) -> Self
Builder helper for env vars.
Sourcepub fn with_root_markers<I, S>(self, markers: I) -> Self
pub fn with_root_markers<I, S>(self, markers: I) -> Self
Builder helper for root markers (e.g. ["Cargo.toml", ".git"]).
Sourcepub fn with_file_patterns<I, S>(self, patterns: I) -> Self
pub fn with_file_patterns<I, S>(self, patterns: I) -> Self
Builder helper for file-pattern globs.
Sourcepub fn with_initialization_options(self, opts: Value) -> Self
pub fn with_initialization_options(self, opts: Value) -> Self
Builder helper for initializationOptions.
Trait Implementations§
Source§impl Clone for ServerConfig
impl Clone for ServerConfig
Source§fn clone(&self) -> ServerConfig
fn clone(&self) -> ServerConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for ServerConfig
impl RefUnwindSafe for ServerConfig
impl Send for ServerConfig
impl Sync for ServerConfig
impl Unpin for ServerConfig
impl UnsafeUnpin for ServerConfig
impl UnwindSafe for ServerConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more