pub struct WorkspaceConfig {
pub roots: Vec<ConfiguredRoot>,
pub position_encodings: PositionEncodings,
pub language_extensions: Vec<LanguageExtensionMapping>,
pub heuristics_max_depth: SearchDepth,
pub max_documents: DocumentLimit,
pub max_file_size: SizeLimit,
pub indexing_ready_timeout_seconds: IndexingReadyTimeoutSecs,
pub max_concurrent_server_starts: ServerStartConcurrency,
}Expand description
Workspace-level configuration.
Fields§
§roots: Vec<ConfiguredRoot>Root directories for the workspace.
Entries are kept as written (relative entries of a loaded config file
are rebased by ServerConfig::load_from but not canonicalized);
crate::bridge::WorkspaceRoots::from_configured derives the
canonical roots and the accepted alternative spellings from them.
position_encodings: PositionEncodingsPosition 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;
an empty list or an unrecognized value is rejected when the config is
loaded.
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: SearchDepthMaximum depth for recursive project marker search.
Controls how deeply nested projects can be detected.
Default: 10. Values above MAX_HEURISTICS_DEPTH are rejected when the config is loaded.
max_documents: DocumentLimitMaximum 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: SizeLimitMaximum size, in bytes, of a single file DocumentTracker will open.
A file larger than this fails with FileSizeLimitExceeded. 0
disables the limit. Values above MAX_FILE_SIZE_LIMIT are rejected
when the config is loaded. The per-response disk-read budget for
position conversion scales with this value.
Default: 10485760 (10MB)
indexing_ready_timeout_seconds: IndexingReadyTimeoutSecsMaximum 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); anything else is rejected when the
config is loaded.
Default: 30
max_concurrent_server_starts: ServerStartConcurrencyMaximum number of LSP servers started at the same time; the rest start as earlier ones settle. Default: 8
Implementations§
Source§impl WorkspaceConfig
impl WorkspaceConfig
Sourcepub fn build_extension_map(&self) -> HashMap<FileExtension, LanguageId>
pub fn build_extension_map(&self) -> HashMap<FileExtension, LanguageId>
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 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.