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,
pub indexing_ready_timeout_seconds: 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 new document once this count is
reached evicts the least-recently-used tracked document that is both
unlocked (no ensure_open/update call currently in flight against
it) and disk-verified (sending textDocument/didClose to every
server that had it open), making room rather than failing;
already-tracked paths are unaffected. Falls back to
DocumentLimitExceeded when no tracked document is both, which at
the default of 100 only happens under pathological concurrency, but
at a very small configured value (e.g. 1-2) is easy to hit under
ordinary concurrent use. A too-small limit does not just risk that
error, either: it can cause silent thrashing, evicting and
re-reading a document (a full disk read plus a fresh didOpen) on
every access as the same handful of files repeatedly fall out of and
back into the tracker. 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)
indexing_ready_timeout_seconds: u64Maximum time, in seconds, a whole-workspace query (hover, definition,
references, rename, completions, code actions, call hierarchy
incoming/outgoing calls) waits for its routed LSP server to report
workspace-indexing readiness before failing with
crate::error::Error::WorkspaceIndexing (see
crate::bridge::Translator::with_indexing_ready_timeout). Only
takes effect once a readiness signal has actually shown indexing is
in progress – a server that never reports one is never delayed.
Must be strictly between PROGRESS_SETTLE (3s) and
INDEXING_STALENESS_BOUND (60s); see ServerConfig::validate.
Default: 30
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 language_for_extension(&self, extension: &str) -> Option<String>
pub fn 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.