Skip to content

Make the empty Explorer view movable - #335999

Merged
Dmitriy Vasyura (dmitrivMS) merged 1 commit into
microsoft:mainfrom
Megafia:fix/empty-explorer-view-can-move
Sep 22, 2026
Merged

Dmitriy Vasyura (dmitrivMS) merged 1 commit into
microsoft:mainfrom
Megafia:fix/empty-explorer-view-can-move

Conversation

@Megafia

@Megafia Megafia commented Sep 13, 2026 •

Copy link
Copy Markdown

Fixes #335217

The problem

With a folder open, the Explorer's Folders view can be dragged into any other view container — for example into a Panel container shared with Terminal, Source Control and Search.

With no folder open, that is not possible. The Explorer shows No Folder Opened (workbench.explorer.emptyView) instead, and that view cannot be dragged at all. A layout built with a folder open therefore cannot be reproduced in an empty window, and the Explorer jumps back out into its own container whenever the last folder is closed or a new empty window is opened.

The cause

createEmptyViewDescriptor() does not set canMoveView. Its two siblings in the same file do:

descriptor canMoveView
createOpenEditorsViewDescriptor() true
createExplorerViewDescriptor() (Folders) true
createEmptyViewDescriptor() (No Folder Opened) (missing)

canMoveView is optional and undefined is falsy, so both the drag source and the drop targets in viewPaneContainer.ts reject the view.

This looks like an oversight rather than a deliberate restriction: 6ee9724 ("Explore making the explorer a moveable view") added the flag to the Folders descriptor and did not touch the empty view, even though the two views are swapped in and out by the same code path in ExplorerViewletViewsContribution.registerViews().

The change

Add canMoveView: true to createEmptyViewDescriptor().

The empty view is registered and deregistered as the workbench state changes, but that is already handled: regroupViews() in viewDescriptorService.ts consults each view's persisted custom location on both register and deregister, so a moved empty view is removed from — and later restored to — wherever the user put it. The Folders view already relies on this same machinery. View welcome content is registered against EmptyView.ID, so it travels with the view.

Note for reviewers

This also makes the Explorer container draggable in an empty window. Container-level drag is gated on every view in the container being movable (viewPaneContainer.ts), which the empty view's missing flag currently blocks. After this change an empty window behaves like a window with a folder open, where Folders and Open Editors are both movable. That seems desirable and consistent, but it is a second behavioural effect and is not mentioned in the issue.

Verification

  • vs/workbench/services/views/test/** — 37 passing
  • vs/workbench/contrib/files/test/** — 125 passing
  • vs/workbench/** — 15207 passing

(ModernUIContribution > pane composite actions fill regular and Agents headers fails in the full workbench run, but it fails identically on an unmodified main and is unrelated to this change.)

Copilot AI balanced review requested due to automatic review settings September 13, 2026 00:56
@Megafia
Megafia marked this pull request as ready for review September 13, 2026 00:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The focused change aligns the empty view with existing Explorer descriptors and movement infrastructure.

Pull request overview

Enables the empty Explorer view to participate in standard view movement behavior.

Changes:

  • Marks “No Folder Opened” as movable.
  • Enables consistent view/container dragging in empty windows.
File summaries
File Description
src/vs/workbench/contrib/files/browser/explorerViewlet.ts Enables movement for the empty Explorer view descriptor.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: Balanced (auto)

Note

Copilot is running an experiment and ran this review at Balanced.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

`createEmptyViewDescriptor()` was missing `canMoveView: true`, which its
siblings (Folders, Open Editors) both set. As a result the "No Folder
Opened" view could not be dragged into another view container, so a
layout built with a folder open could not be reproduced in an empty
window.

Fixes microsoft#335217
@dmitrivMS
Dmitriy Vasyura (dmitrivMS) merged commit 620a1b4 into microsoft:main Sep 22, 2026
33 checks passed
@vs-code-engineering vs-code-engineering Bot added this to the 1.140.0 milestone Sep 22, 2026
@vs-code-engineering vs-code-engineering Bot locked and limited conversation to collaborators Nov 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explorer must stay standalone when no folder is opened: "No Folder Opened" view is missing canMoveView

5 participants