Repository navigation
Editor parts: several editor parts per window, and embedded editor parts - #345074
Closed
Sandeep Somavarapu (sandy081) wants to merge 3 commits into
Closed
Sandeep Somavarapu (sandy081) wants to merge 3 commits into
Sandeep Somavarapu (sandy081) wants to merge 3 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Unresolved embedded-editor defects can dispose groups mid-batch, route editors and drops to the wrong part, and disrupt layout and owner notifications.
8 open issues
Route bulk opens using each editor's actual destination group · New Announce every restored group when creating an editor part · New Resolve the closest matching part root in getPart() · New Defer part teardown until close listeners finish · New Disable automatic group locking for embedded parts · New Forward size constraint changes through onDidChange · New Initialize editor root classes for plain container hosts · New Defer empty-group cleanup until bulk editor opening completes · New
What changed in this PR
Adds infrastructure for multiple editor parts in one window and feature-owned embedded editor areas, preparing for chat windows in #344666. No feature creates embedded parts yet, so existing UI behavior is intended to remain unchanged.
Changes:
- Adds embedded-part creation, scoped services, editor redirection and window-lifecycle binding.
- Updates part lookup, persistence and clipping for multiple parts per window.
- Gates embedded-part menus and adds lifecycle, routing and state tests.
| File | Description |
|---|---|
src/vs/workbench/test/browser/workbenchTestServices.ts |
Adds embedded-part API stubs. |
src/vs/workbench/test/browser/parts/editor/embeddedEditorPartMenus.test.ts |
Tests terminal menu gating. |
src/vs/workbench/services/editor/test/browser/modalEditorGroup.test.ts |
Tests part lookup within a shared document. |
src/vs/workbench/services/editor/test/browser/embeddedEditorPart.test.ts |
Tests embedded-part services, routing, state and lifecycle. |
src/vs/workbench/services/editor/common/editorGroupsService.ts |
Defines embedded-part interfaces and creation options. |
src/vs/workbench/services/editor/browser/editorPartWindowBinding.ts |
Binds embedded parts to auxiliary-window closure. |
src/vs/workbench/contrib/webviewPanel/browser/webviewEditor.ts |
Uses the containing part for webview clipping. |
src/vs/workbench/contrib/terminal/browser/terminalMenus.ts |
Hides panel-transfer actions in embedded parts. |
src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.ts |
Uses the containing part for notebook clipping. |
src/vs/workbench/common/contextkeys.ts |
Adds the embedded-part context key. |
src/vs/workbench/browser/parts/editor/ownedEditorPart.ts |
Extracts shared owned-part closing behavior. |
src/vs/workbench/browser/parts/editor/embeddedEditorPart.ts |
Implements embedded parts and their factory. |
src/vs/workbench/browser/parts/editor/editorParts.ts |
Adds per-part service scoping, lookup and persistence handling. |
src/vs/workbench/browser/parts/editor/editorPart.ts |
Adds the transient-part marker. |
src/vs/workbench/browser/parts/editor/editorGroupView.ts |
Redirects editor opens, moves and copies. |
src/vs/workbench/browser/parts/editor/editor.ts |
Adds the editor-redirection contract. |
src/vs/workbench/browser/parts/editor/editor.contribution.ts |
Gates group and window actions for embedded parts. |
src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.ts |
Reuses the shared owned-part implementation. |
Review effort: Balanced
Sandeep Somavarapu (sandy081)
force-pushed
the
agents/editor-parts-embedded
branch
from
October 29, 2026 22:09
8e7965f to
633db7c
Compare
Several editor parts can live in one window, so assumptions of a single part per window are replaced: - scoped instantiation services are keyed by part instead of by window id - `getPart(element)` resolves by ancestry first (strict descendants only, the container itself falls back to the document lookup) and then by document - editor parts that are owned by someone else (`isTransient`) are excluded from persisted state, labels, working sets and window restore, and keep their position in the most recently active list when state is restored - webview and notebook clipping use the part that contains the editor - adds the `OwnedEditorPart` base class shared by owner-managed parts, which the auxiliary editor part now extends with unchanged behavior Co-authored-by: Copilot <[email protected]>
…r parts
Adds `IEditorGroupsService.createEditorPart({ container, label?, groupViewOptions?, state?, primary? })`
which creates an editor part inside a container owned by the caller (for example a grid cell in
an auxiliary window). The part has its own scoped instantiation and editor services, is always
excluded from working sets, window restore and persisted state, and closes by merging
editors that need confirmation into the main part.
`primary` makes the part the active one for its window when focus is in no part.
`bindEditorPartsToWindow` ties the parts to an auxiliary window: it vetoes closing the window when an
editor cannot be moved and closes the parts on unload.
The part's own groups are laid out by its owner: an embedded part keeps its last group, also as closing all
its editors closes empty groups, and its groups (editorPartEmbedded) offer no Lock or Unlock Group, no Close
Group for their only group, and no moving of their editors into a new window or, for terminals, into the panel.
Elsewhere, editorPartEmbedded never holds, so these menus are unchanged.
`redirectEditor` limits the editors a part takes: an editor it does not take opens in the group of another
part that it returns, however the editor gets to the part (opened there, including as the active group or to
the side of one of its groups, moved, copied or dropped there), and a group of the part left without editors
that way is removed. The group views enforce it as they open, move and copy editors. Parts without it, such
as the main part, take every editor as before.
Co-authored-by: Copilot <[email protected]>
- openEditors routes each redirected editor to its destination group, with that group's indices and resulting pane, and removes a group left empty only after the whole batch - announce every group of a part created with state - getPart resolves the closest part, including the root of an embedded part - release an embedded part after its onWillClose listeners were notified - enforce no auto locking in embedded parts - add the part and editor classes to the root of an embedded part Co-authored-by: Copilot <[email protected]>
Sandeep Somavarapu (sandy081)
force-pushed
the
agents/editor-parts-embedded
branch
from
November 2, 2026 08:27
9702993 to
de465d3
Compare
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.

Infrastructure, no user-visible change.
Lets a window host several editor parts and lets a feature create editor parts of its own, embedded in its UI. It's the first infrastructure block for chat windows (#344666), which are behind
sessions.chatWindows.enabled.getPart(element)resolves the part by ancestry first, then by document.isTransient) parts are left out of persisted state, labels, working sets and window restore.OwnedEditorPartbase class holds what the auxiliary editor part did, unchanged: closing a floating window's last group still activates the second most recently active group.createEditorPart: creates an embedded editor part that a feature owns and lays out.bindEditorPartsToWindowties such parts to an auxiliary window.editorPartEmbedded, which is never set outside embedded parts, so they're unchanged everywhere else.Nothing in VS Code creates an embedded part yet.
How to test
No UI change: floating editor windows, the modal editor, webviews and notebooks behave as before.
Validation (alone on main 6eb26fe)
npm run typecheck-client: passed at every commitnpm run build-fast -- --client-only: passed./scripts/test.sh --runGlob "vs/sessions/**/*.test.js": 9299 passing./scripts/test.sh --runGlob "vs/workbench/services/**/*.test.js": 2905 passing./scripts/test.sh --runGlob "vs/workbench/test/**/*.test.js": 733 passing