pub trait LanguagePlugin: Send + Sync {
// Required methods
fn language_id(&self) -> &'static str;
fn file_extensions(&self) -> &'static [&'static str];
fn marker_files(&self) -> &'static [&'static str];
fn marker_search_depth(&self) -> u32;
fn lsp_candidates(&self) -> &[LspCandidate];
fn install_hint(&self) -> &'static str;
}Expand description
Per-language LSP behaviour abstraction.
Implementations are pure data providers — no I/O, no async. This makes them trivially testable and composable.
Required Methods§
Sourcefn language_id(&self) -> &'static str
fn language_id(&self) -> &'static str
Short identifier used as a map key (e.g., "rust", "go", "typescript", "python").
Sourcefn file_extensions(&self) -> &'static [&'static str]
fn file_extensions(&self) -> &'static [&'static str]
File extensions that this language handles.
Used by [language_id_for_extension] and [touch_language] in LT-4.
Example: &["rs"] for Rust, &["ts", "tsx", "js", "jsx", "mjs", "cjs", "vue"] for TypeScript.
Sourcefn marker_files(&self) -> &'static [&'static str]
fn marker_files(&self) -> &'static [&'static str]
Marker files that indicate this language is used in the workspace.
Returned in priority order — detection stops at the first match.
Example: &["Cargo.toml"] for Rust, &["tsconfig.json", "package.json"] for TypeScript.
Sourcefn marker_search_depth(&self) -> u32
fn marker_search_depth(&self) -> u32
Maximum directory depth to search for marker files.
0 = root only, 2 = root + up to 2 levels deep (for monorepos).
Sourcefn lsp_candidates(&self) -> &[LspCandidate]
fn lsp_candidates(&self) -> &[LspCandidate]
LSP binary candidates in preference order.
Detection tries each candidate via which and uses the first found.
Example: Rust has one (rust-analyzer), Python has four
(pyright-langserver, pylsp, ruff-lsp, jedi-language-server).
Sourcefn install_hint(&self) -> &'static str
fn install_hint(&self) -> &'static str
Human-readable install guidance when no LSP binary is found.