pub struct ServerConfig {
pub workspace: WorkspaceConfig,
pub lsp_servers: Vec<LspServerConfig>,
}Expand description
Main configuration for the MCPLS server.
Fields§
§workspace: WorkspaceConfigWorkspace configuration.
lsp_servers: Vec<LspServerConfig>LSP server configurations.
Implementations§
Source§impl ServerConfig
impl ServerConfig
Sourcepub fn build_effective_extension_map(&self) -> HashMap<String, String>
pub fn build_effective_extension_map(&self) -> HashMap<String, String>
Build the effective extension map used for language detection.
Starts with workspace mappings and overlays mappings inferred from
configured LSP server file_patterns.
Sourcepub fn load() -> Result<Self>
pub fn load() -> Result<Self>
Load configuration from the default path, treating a CWD-discovered
./mcpls.toml as untrusted.
Default paths checked in order:
$MCPLS_CONFIGenvironment variable (always trusted)./mcpls.toml(current directory) — skipped; seeload_with_trustto opt in~/.config/mcpls/mcpls.toml(Linux/macOS)%APPDATA%\mcpls\mcpls.toml(Windows)
If no configuration file exists, creates a default configuration file in the user’s config directory with all default language extensions.
This is a thin wrapper around
load_with_trust(ProjectConfigTrust::Untrusted) —
the safe default for library callers that haven’t made a trust
decision.
§Errors
Returns an error if parsing an existing config fails. If config creation fails, returns default config with graceful degradation.
Sourcepub fn load_with_trust(trust: ProjectConfigTrust) -> Result<Self>
pub fn load_with_trust(trust: ProjectConfigTrust) -> Result<Self>
Load configuration from the default path, with explicit control over
whether a CWD-discovered ./mcpls.toml is honored.
Behaves like load, except a ./mcpls.toml found in
the current directory is only loaded when trust is
ProjectConfigTrust::Trusted. When untrusted, the file is skipped
entirely (including its [workspace] section) and a warning is
logged naming the ignored path; discovery falls through to the
global config tier or built-in defaults, so project-marker
heuristics (e.g. Cargo.toml → rust-analyzer) still apply normally.
$MCPLS_CONFIG and an explicit path are unaffected by trust and
are always loaded: naming a path is itself the user’s consent.
§Errors
Returns an error if parsing an existing config fails. If config creation fails, returns default config with graceful degradation.
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 more