fix: scope editor service in window title to own editor groups container#306226
Merged
bpasero merged 4 commits intomicrosoft:mainfrom Mar 30, 2026
Merged
Conversation
The main window's WindowTitle used the global IEditorService which tracks editor groups across all windows including auxiliary windows. When a terminal was moved to a new window, the auxiliary window's active editor change propagated to the main window's title, causing it to incorrectly display the terminal name instead of the open file. Scope the editor service used by WindowTitle to the window's own editor groups container so each window title only reflects editors within that window. Closes microsoft#267538
Contributor
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: @bpaseroMatched files:
|
Member
|
This is a really good catch and I wonder if this regressed, I thought I tested this back when aux windows got introduced. |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes incorrect main window title updates when focus/active editor changes occur in auxiliary windows by ensuring WindowTitle reads a window-scoped IEditorService tied to that window’s editor groups container.
Changes:
- Create a child
IInstantiationServiceinBrowserTitlebarPartthat overridesIEditorServicewitheditorService.createScoped(editorGroupsContainer, ...). - Instantiate
WindowTitlevia the scoped instantiation service so it only tracks editors within the current window. - Update editor-action toolbar context gating to use
editorGroupsContainer.activeGroup.activeEditorinstead of the globaleditorService.activeEditor.
bpasero
approved these changes
Mar 30, 2026
hediet
approved these changes
Mar 30, 2026
rzhao271
approved these changes
Mar 30, 2026
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.
What kind of change does this PR introduce?
Bug fix
What is the current behavior?
The main window's
WindowTitleuses the globalIEditorService, which tracks editor groups across all windows including auxiliary windows. When a terminal is moved from the panel to a new auxiliary window via "Move Terminal into New Window", the following sequence occurs:EditorParts.activePartnow returns the auxiliary part (based ongetActiveDocument())EditorServicefiresonDidActiveEditorChangeWindowTitlereadseditorService.activeEditor, which resolves throughactivePartto the auxiliary window's terminal editorThis also affects any editor moved to a new auxiliary window, not just terminals.
Closes #267538
What is the new behavior?
Each
WindowTitlenow receives a scopedIEditorServicethat only tracks editors within its own window's editor groups container. This is done by creating a child instantiation service with a scoped editor service in theBrowserTitlebarPartconstructor:editorGroupService.mainPart, so it only tracks editors in the main windowauxiliaryEditorPart.ts(line 202-203), where a scoped editor service is already created for the auxiliary editor partAfter the fix, moving a terminal (or any editor) to a new window no longer affects the original window's title.
Additional context
The auxiliary window's
WindowTitlewas already getting a correctly scoped editor service viascopedEditorPartInstantiationService(created inauxiliaryEditorPart.ts). The main window'sWindowTitlewas the only one using the global (unscoped) editor service, which made it susceptible to cross-window active editor changes.The fix follows the same scoping pattern already established for auxiliary windows but applies it uniformly in
BrowserTitlebarPartfor all windows.