Improve worktree switching stability and explorer state persistence #55
Merged
amandal0903 merged 7 commits intomainfrom Apr 2, 2026
Merged
Improve worktree switching stability and explorer state persistence #55amandal0903 merged 7 commits intomainfrom
amandal0903 merged 7 commits intomainfrom
Conversation
added 7 commits
April 2, 2026 04:41
Drop the IProgressService wrapper and hardcoded setTimeout delay from switchTo(), making worktree switches faster. Document known desktop app issues (editor restore, layout distortion, switch latency) in CLAUDE.md. Simplify test mocks accordingly.
The folder swap during worktree switching triggers an extension host restart (10ms scheduler in WorkspaceChangeExtHostRelauncher). Editors that depend on extension-provided services (e.g. diff editors via the git extension) can hit a "Canceled" RPC error while the host restarts, showing an error placeholder. This adds a delayed auto-retry that re-opens any error placeholder editors after 1.5s, with up to 3 attempts — effectively auto-clicking "Try Again".
Save and restore the explorer tree's expand/scroll/focus state per worktree so switching back to a previously visited worktree re-opens the same folders the user had expanded. State is cached in-memory keyed by worktree path, saved on onDidChangeActiveWorktree, and restored when setInput re-initialises the tree after the folder swap. Stale entries are cleaned up on worktree removal.
…ibution Move per-worktree file explorer state caching out of ExplorerView and into a dedicated OrchestratorExplorerContribution, matching the pattern used by OrchestratorTerminalContribution. This removes the direct IOrchestratorService dependency from ExplorerView and exposes minimal hooks (getTreeViewState/setPendingTreeViewState) through IExplorerService. Also hardens the editor auto-retry: catch errors from disposed InstantiationService during worktree switch and reduce retry delay to 500ms for faster recovery.
amandal0903
added a commit
that referenced
this pull request
Apr 3, 2026
) * migration plans * remove progress wrapper and 1500ms timeout from worktree switching Drop the IProgressService wrapper and hardcoded setTimeout delay from switchTo(), making worktree switches faster. Document known desktop app issues (editor restore, layout distortion, switch latency) in CLAUDE.md. Simplify test mocks accordingly. * remove known issues section from root CLAUDE.md * auto-retry failed editors after worktree switch The folder swap during worktree switching triggers an extension host restart (10ms scheduler in WorkspaceChangeExtHostRelauncher). Editors that depend on extension-provided services (e.g. diff editors via the git extension) can hit a "Canceled" RPC error while the host restarts, showing an error placeholder. This adds a delayed auto-retry that re-opens any error placeholder editors after 1.5s, with up to 3 attempts — effectively auto-clicking "Try Again". * persist file explorer tree state across worktree switches Save and restore the explorer tree's expand/scroll/focus state per worktree so switching back to a previously visited worktree re-opens the same folders the user had expanded. State is cached in-memory keyed by worktree path, saved on onDidChangeActiveWorktree, and restored when setInput re-initialises the tree after the folder swap. Stale entries are cleaned up on worktree removal. * decouple explorer tree state persistence from ExplorerView into contribution Move per-worktree file explorer state caching out of ExplorerView and into a dedicated OrchestratorExplorerContribution, matching the pattern used by OrchestratorTerminalContribution. This removes the direct IOrchestratorService dependency from ExplorerView and exposes minimal hooks (getTreeViewState/setPendingTreeViewState) through IExplorerService. Also hardens the editor auto-retry: catch errors from disposed InstantiationService during worktree switch and reduce retry delay to 500ms for faster recovery. * remove migration plan files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
dependency from ExplorerView. This matches the existing pattern used by OrchestratorTerminalContribution and keeps orchestrator logic out of core VS Code files.