Skip to main content

LanguagePlugin

Trait LanguagePlugin 

Source
pub trait LanguagePlugin: Send + Sync {
Show 20 methods // Required methods fn name(&self) -> &str; fn extensions(&self) -> &[&str]; fn key_files(&self) -> &[&str]; fn get_lsp_config(&self) -> LspConfig; fn get_init_action(&self, opts: &InitOptions) -> ProjectAction; fn check_tooling_action(&self, path: &Path) -> ProjectAction; fn init_command(&self, opts: &InitOptions) -> String; fn test_command(&self) -> String; fn run_command(&self) -> String; // Provided methods fn detect(&self, path: &Path) -> bool { ... } fn run_command_for_dir(&self, _path: &Path) -> String { ... } fn syntax_check_command(&self) -> Option<String> { ... } fn build_command(&self) -> Option<String> { ... } fn lint_command(&self) -> Option<String> { ... } fn file_ownership_patterns(&self) -> &[&str] { ... } fn owns_file(&self, path: &str) -> bool { ... } fn host_tool_available(&self) -> bool { ... } fn required_binaries(&self) -> Vec<(&str, &str, &str)> { ... } fn lsp_fallback(&self) -> Option<LspConfig> { ... } fn verifier_profile(&self) -> VerifierProfile { ... }
}
Expand description

A plugin for a specific programming language

PSP-5 expands this trait beyond init/test/run to a full capability-based runtime contract that governs detection, verification, LSP, and ownership.

Required Methods§

Source

fn name(&self) -> &str

Name of the language

Source

fn extensions(&self) -> &[&str]

File extensions this plugin handles

Source

fn key_files(&self) -> &[&str]

Key files that identify this language (e.g., Cargo.toml, pyproject.toml)

Source

fn get_lsp_config(&self) -> LspConfig

Get the LSP configuration for this language

Source

fn get_init_action(&self, opts: &InitOptions) -> ProjectAction

Get the action to initialize a new project (greenfield)

Source

fn check_tooling_action(&self, path: &Path) -> ProjectAction

Check if an existing project needs tooling sync (e.g., uv sync, cargo fetch)

Source

fn init_command(&self, opts: &InitOptions) -> String

Get the command to initialize a new project DEPRECATED: Use get_init_action instead

Source

fn test_command(&self) -> String

Get the command to run tests

Source

fn run_command(&self) -> String

Get the command to run the project (for verification)

Provided Methods§

Source

fn detect(&self, path: &Path) -> bool

Detect if this plugin should handle the given project directory

Source

fn run_command_for_dir(&self, _path: &Path) -> String

Get the command to run the project in a specific directory.

Override this to inspect pyproject.toml, Cargo.toml, etc. and return a more appropriate run command than the generic default.

Source

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

Get the syntax/type check command (e.g., cargo check, uv run ty check .)

Returns None if the plugin has no syntax check command (uses LSP only).

Source

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

Get the build command (e.g., cargo build, npm run build)

Returns None if the language doesn’t have a separate build step.

Source

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

Get the lint command (e.g., cargo clippy -- -D warnings)

Used only in VerifierStrictness::Strict mode.

Source

fn file_ownership_patterns(&self) -> &[&str]

File glob patterns this plugin owns (e.g., ["*.rs", "Cargo.toml"])

Used for node ownership matching in multi-language repos.

Source

fn owns_file(&self, path: &str) -> bool

PSP-5 Phase 2: Check if a file path belongs to this plugin’s ownership domain

Uses file_ownership_patterns() for suffix/extension matching.

Source

fn host_tool_available(&self) -> bool

Check if the host has the required build tools available

Returns true if the plugin’s primary toolchain is installed and callable. When false, the runtime enters degraded-validation mode.

Source

fn required_binaries(&self) -> Vec<(&str, &str, &str)>

Required host binaries for this plugin, grouped by role.

Each entry is (binary_name, role_description, install_hint). The orchestrator checks these before init and emits install directions for any that are missing.

Source

fn lsp_fallback(&self) -> Option<LspConfig>

Get fallback LSP config when primary is unavailable

Source

fn verifier_profile(&self) -> VerifierProfile

Build a complete verifier profile by probing each capability.

The default implementation auto-assembles from the existing syntax_check_command(), build_command(), test_command(), lint_command(), and host_tool_available() methods.

Plugins override this method to provide per-sensor probing with distinct fallback commands and independent availability checks.

Implementors§