Manage Git worktrees and their development servers without leaving VS Code. TreeSwap adds a collapsible Git Worktrees view near the bottom of the Explorer, where each worktree can have its own package.json and selected npm script.
Install
Install TreeSwap from the VS Code Marketplace, or install a .vsix package using Extensions: Install from VSIX.... You do not need to run npm install to use the extension.
Features
View the Git worktrees registered to the repository in your workspace.
Expand a worktree card to choose a package.json. By default, TreeSwap looks for <worktree>/package.json.
Select one of the package's scripts; the choice is saved separately for each worktree.
Start the selected script from the worktree card. It runs in a dedicated VS Code integrated terminal.
Press Stop while a script is running to send an interrupt. If it does not stop promptly, TreeSwap closes its terminal.
Check the status lamp on each card to see whether a script is running.
See how much memory a worktree's running scripts are using, updated every few seconds next to the status lamp.
Reveal a worktree in the Explorer while keeping your existing editors and workspace folders.
Requirements
Open a folder from the Git repository whose worktrees you want to manage.
Git must be installed and available on PATH.
Node.js and npm are needed only if you want to run npm scripts from package files.
Usage
Open the repository folder in VS Code.
Find Git Worktrees near the bottom of the Explorer sidebar.
Expand a worktree card. Choose a package.json if it is not in the worktree root.
Select a script from the list. The selection is remembered for that worktree.
Use the button beside the worktree name to run the selected script. Press Stop to interrupt it.
Use Refresh Worktrees in the view title after adding or removing worktrees. Use the view's title actions to expand or collapse all cards.