Expand description
ยงWorkspaceProvider (Environment)
RESPONSIBILITIES:
- Implements
WorkspaceProviderandWorkspaceEditAppliertraits forMountainEnvironment - Manages multi-root workspace folder operations and configuration
- Provides workspace trust management and file discovery capabilities
- Handles workspace edit application and custom editor routing
ARCHITECTURAL ROLE:
- Core provider in the Environment system, exposing workspace-level
functionality to frontend via gRPC through the
AirService - Workspace provider is one of the foundational services alongside Document, Configuration, and Diagnostic providers
- Integrates with
ApplicationStatefor persistent workspace folder storage
ERROR HANDLING:
- Uses
CommonErrorfor all operations - Application state lock errors are mapped using
Utility::MapApplicationStateLockErrorToCommonError - Some operations are stubbed with logging (FindFilesInWorkspace, OpenFile, ApplyWorkspaceEdit)
PERFORMANCE:
- Workspace folder lookup uses O(n) linear search through folder list
- Lock contention on
ApplicationState.Workspace.WorkspaceFoldersshould be minimized - File discovery and workspace edit application are not yet optimized
VS CODE REFERENCE:
vs/workbench/services/workspace/browser/workspaceService.ts- workspace service implementationvs/workbench/contrib/files/common/editors/textFileEditor.ts- file editor integrationvs/platform/workspace/common/workspace.ts- workspace types and interfaces
TODO:
- Implement actual file search with glob pattern matching
- Implement file opening with workspace-relative paths
- Complete workspace edit application logic
- Add workspace event propagation to subscribers
- Implement custom editor routing by view type
MODULE CONTENTS:
WorkspaceProviderimplementation:GetWorkspaceFoldersInfo- enumerate all workspace foldersGetWorkspaceFolderInfo- find folder containing a URIGetWorkspaceName- workspace identifier from stateGetWorkspaceConfigurationPath- .code-workspace pathIsWorkspaceTrusted- trust status checkRequestWorkspaceTrust- trust acquisition (stub)FindFilesInWorkspace- file discovery (stub)OpenFile- file opening (stub)WorkspaceEditApplierimplementation:ApplyWorkspaceEdit- edit application (stub)- Data types: [
(Url, String, usize)] tuple for folder info (URI, name, index)