pub struct WorkspaceConfig {
pub roots: Vec<PathBuf>,
pub position_encodings: Vec<String>,
pub language_extensions: Vec<LanguageExtensionMapping>,
pub heuristics_max_depth: usize,
pub max_documents: usize,
pub max_file_size: u64,
}Expand description
Workspace-level configuration.
Fields§
§roots: Vec<PathBuf>Root directories for the workspace.
position_encodings: Vec<String>Position encoding preference order, offered to each spawned LSP
server as capabilities.general.positionEncodings during the
initialize handshake (see crate::lsp::LspServer::spawn), in the
order configured here.
Valid values: "utf-8", "utf-16", "utf-32". Must be non-empty;
ServerConfig::validate rejects an empty list or an unrecognized
value.
language_extensions: Vec<LanguageExtensionMapping>File extension to language ID mappings. Allows users to customize which file extensions map to which language servers.
heuristics_max_depth: usizeMaximum depth for recursive project marker search. Controls how deeply nested projects can be detected. Default: 10
max_documents: usizeMaximum number of documents DocumentTracker will keep open
simultaneously. A textDocument/didOpen-triggering tool call (hover,
definition, diagnostics, etc.) for a document beyond this count fails
with DocumentLimitExceeded. Documents stay tracked for the whole
mcpls process lifetime (there is no eviction), so once the ceiling is
reached, opening any further new path fails until either the process
is restarted or this limit is raised; already-tracked paths are
unaffected. 0 disables the limit.
Default: 100
max_file_size: u64Maximum size, in bytes, of a single file DocumentTracker will open.
A file larger than this fails with FileSizeLimitExceeded. 0
disables the limit.
Default: 10485760 (10MB)
Implementations§
Source§impl WorkspaceConfig
impl WorkspaceConfig
Sourcepub fn build_extension_map(&self) -> HashMap<String, String>
pub fn build_extension_map(&self) -> HashMap<String, String>
Build a map of file extensions to language IDs from the configuration.
§Returns
A HashMap where keys are file extensions (without the dot) and values
are the corresponding language IDs to report to LSP servers.
Sourcepub fn get_language_for_extension(&self, extension: &str) -> Option<String>
pub fn get_language_for_extension(&self, extension: &str) -> Option<String>
Sourcepub const fn resource_limits(&self) -> ResourceLimits
pub const fn resource_limits(&self) -> ResourceLimits
Maps the configured max_documents/max_file_size onto the bridge
layer’s ResourceLimits, for Translator::with_resource_limits.
Trait Implementations§
Source§impl Clone for WorkspaceConfig
impl Clone for WorkspaceConfig
Source§fn clone(&self) -> WorkspaceConfig
fn clone(&self) -> WorkspaceConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more