NOSSLETTER.techLIVE
back to archive

Folder location: per-location editor working sets

Language: TypeScript+421 -12feature
concepts demonstrated
Workspace storage APIEditor state persistenceTypeScript settings configurationUnit testing with TypeScript
The Issue & Context

Before this change, switching between different folder locations in a multi-root workspace would lose the open editors for the previous location, forcing users to reopen files manually.

Root Cause Analysis

The editor state was managed globally per workspace without distinguishing between individual folder locations, so open editors were not saved or restored when switching contexts within the workspace.

Solution Strategy & Architectural Pattern

This PR introduces a per-location working set stored in workspace storage that saves and restores open editors when switching folder locations. It tracks editor handles capped at 20 entries, carries over dirty editors without prompting, and adds a new setting to control this behavior. The implementation includes new logic in folderLocationWorkingSets.ts and updates editor group services to support this state separation.

Key Takeaway for Contributors

When managing editor or UI state in multi-context environments, explicitly partitioning state by context (here, folder location) prevents user disruption and improves UX by preserving state per context rather than globally.