Skip to main content

Module Environment

Module Environment 

Source
Expand description

Capability providers: file system, process, terminal, and extension host.

§Environment

Dependency injection container that provides thread-safe access to all Mountain providers through trait-based lookups via the Requires trait.

Component -> Requires<T> -> MountainEnvironment -> Arc<dyn T>

MountainEnvironment implements the Environment and Requires traits from the Common crate. It is constructed once during startup and shared as Arc<MountainEnvironment> across all subsystems. Provider trait implementations are generated by ProviderTraitImplMacro to keep boilerplate minimal.

§Provider Traits Implemented

CommandExecutor, ConfigurationProvider, CustomEditorProvider, DebugService, DiagnosticManager, DocumentProvider, FileSystemReader/Writer, FileWatcher, IPCProvider, KeybindingProvider, LanguageFeatureProviderRegistry, OutputChannelManager, SearchProvider, SecretProvider, SourceControlManagementProvider, StatusBarProvider, StorageProvider, SynchronizationProvider, TerminalProvider, TestController, TreeViewProvider, UserInterfaceProvider, WebviewProvider, WorkspaceProvider, WorkspaceEditApplier, ExtensionManagementService.

Providers use CommonError for error reporting. Trait resolution is compile-time, ensuring type safety with zero runtime overhead.

Modules§

CommandProvider
CommandExecutor provider: runs shell commands in a managed subprocess.
ConfigurationProvider
ConfigurationProvider: reads, writes, and watches workspace configuration.
CustomEditorProvider
CustomEditorProvider: registers and resolves custom editor contributions.
DebugProvider
DebugService: manages debug adapter protocol sessions.
DiagnosticProvider
DiagnosticManager: collects and publishes editor diagnostic markers.
DocumentProvider
DocumentProvider: opens, closes, and tracks text document state.
FileSystemProvider
FileSystemReader/Writer: async file-system read and write operations.
FileWatcherProvider
FileWatcher: registers file-system watch patterns and delivers change events.
IPCProvider
IPCProvider: routes IPC messages between the frontend and backend.
KeybindingProvider
KeybindingProvider: resolves keybinding contributions and chord sequences.
LanguageFeatureProvider
LanguageFeatureProviderRegistry: dispatches LSP-like language features.
MountainEnvironment
Main dependency injection container struct implementing all provider traits.
OutputProvider
OutputChannelManager: creates and writes to named output channels.
ProviderTraitImplMacro
Declarative macro that generates Requires<dyn T> impl blocks for each provider trait on MountainEnvironment. Invoked as impl_provider!(CommandExecutor) from the parent file.
SearchProvider
SearchProvider: runs workspace-wide text and symbol searches.
SecretProvider
SecretProvider: reads and writes secrets from the platform credential store.
SourceControlManagementProvider
SourceControlManagementProvider: exposes SCM repository state and actions.
StatusBarProvider
StatusBarProvider: creates and updates status bar items.
StorageProvider
StorageProvider: persists extension and workspace state blobs.
SynchronizationProvider
SynchronizationProvider: coordinates cross-window state synchronization.
TerminalProvider
TerminalProvider: creates and manages integrated terminal instances.
TestProvider
TestController: registers test run profiles and reports test results.
TreeViewProvider
TreeViewProvider: supplies data for tree-view panel contributions.
UserInterfaceProvider
UserInterfaceProvider: drives quick-pick, input-box, and notification UI.
Utility
Shared helpers used across multiple provider implementations. Cross-cutting utilities shared by every Environment provider: error mapping, language detection, workspace-trust path validation, and URI parsing. Callers spell the full path (Environment::Utility::ErrorMapping::Fn, etc.) - no pub use re-exports.
WebviewProvider
WebviewProvider: creates and manages sandboxed webview panels.
WorkspaceProvider
WorkspaceProvider: exposes workspace folders, trust state, and edits.