Middle-click empty space to create folders and open terminals - #334530
Middle-click empty space to create folders and open terminals#334530Fahad Iftikhar (Fahad090NP) wants to merge 4 commits into
Conversation
Middle-clicking empty space in the Explorer view opens a new-folder input, matching the existing double-click behavior for new files. The paste that Linux delivers to the freshly focused input is swallowed so the name starts empty.
Plain middle-click keeps the stock close-group behavior; Ctrl/Cmd+middle-click opens a new terminal in the empty group.
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Benjamin Christopher Simmonds (@benibenj)Matched files:
|
|
Context: this PR replaces #329446, which was closed automatically when my fork was deleted from GitHub. GitHub cannot reopen a PR whose head repository was deleted, so the branch was rebuilt from the original commits (same commit messages and authorship) on top of the current main, which also resolves the merge conflicts the original had. Maintainers: please judge this PR in place of the closed #329446. Thank you! |
There was a problem hiding this comment.
🟡 Changes recommended
Listener retention, terminal targeting, and paste suppression issues remain unresolved.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds middle-click shortcuts for creating Explorer folders and opening terminal editors.
Changes:
- Exposes tree middle-click events.
- Handles middle-clicks on empty Explorer and editor surfaces.
- Suppresses Linux middle-click paste behavior.
File summaries
| File | Description |
|---|---|
src/vs/workbench/contrib/files/browser/views/explorerViewer.ts |
Guards new-name inputs against middle-click paste. |
src/vs/workbench/contrib/files/browser/views/explorerView.ts |
Creates folders from empty Explorer space. |
src/vs/workbench/browser/parts/editor/swallowMiddleClickPaste.ts |
Adds middle-click paste suppression. |
src/vs/workbench/browser/parts/editor/multiEditorTabsControl.ts |
Opens terminals from empty tab rows. |
src/vs/workbench/browser/parts/editor/editorGroupView.ts |
Handles empty editor-group middle-clicks. |
src/vs/base/browser/ui/tree/asyncDataTree.ts |
Exposes middle-click events. |
Review details
Suppressed comments (2)
src/vs/workbench/browser/parts/editor/editorGroupView.ts:430
- Plain middle-click still reaches this branch and closes the empty group, while the PR and linked issue require plain middle-click to open a terminal instead. Requiring Ctrl/Meta means the advertised empty-canvas shortcut is not implemented; remove the modifier split and always take the terminal path.
} else {
this.groupsView.removeGroup(this);
src/vs/workbench/browser/parts/editor/multiEditorTabsControl.ts:428
- This command defaults to
ACTIVE_GROUP(terminalActions.ts:322), but middle-button presses on the title are ignored by the group focus handler (editorGroupView.ts:509). Middle-clicking an inactive group's empty tabs row can therefore open the terminal in a different group (or window). Pass the clicked group as the command location.
this.commandService.executeCommand('workbench.action.createTerminalEditor');
- Files reviewed: 6/6 changed files
- Comments generated: 5
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- editorGroupView: use MutableDisposable for paste guard, activate group before creating terminal, remove modifier-key requirement - multiEditorTabsControl: use MutableDisposable for paste guard, activate group before creating terminal - swallowMiddleClickPaste: dispose guard immediately after capturing matching event instead of waiting for full timeout - explorerViewer: replace value === '' check with explicit one-shot Linux middle-click flag to avoid blocking pastes on non-middle-click inputs
Fixes #329948
Summary
Add middle-click shortcuts for the two surfaces where double-click already creates a new file:
Commits
Create a folder when middle-clicking empty Explorer spacesrc/vs/base/browser/ui/tree/asyncDataTree.ts— exposeonMouseMiddleClick.src/vs/workbench/contrib/files/browser/views/explorerView.ts— middle-click empty space → new folder.src/vs/workbench/contrib/files/browser/views/explorerViewer.ts— swallow the Linux middle-click paste into the new-folder input.Open a new terminal when middle-clicking empty editor spacesrc/vs/workbench/browser/parts/editor/editorGroupView.ts— empty-container middle-click → new terminal.src/vs/workbench/browser/parts/editor/multiEditorTabsControl.ts— empty tabs-row middle-click → new terminal.Validation
npm run transpile-clientclean.origin/main.Restored PR: This replaces #329446, which was closed automatically when my fork was deleted from GitHub. GitHub cannot reopen a PR whose head repository was deleted, so the branch was rebuilt from the original commits (same commit messages and authorship) on top of the current
main— which also resolves the merge conflicts #329446 had. Please review this PR in place of #329446.