fix: prevent terminal panel from overwriting terminalEditorActive context key#304802
Merged
meganrogge merged 3 commits intomicrosoft:mainfrom Mar 28, 2026
Merged
Conversation
…text key The terminalEditorActive context key was being incorrectly set to false when a terminal in the panel received focus, even though the active editor was still a terminal editor. This happened because TerminalService listened to onDidChangeActiveInstance and set the key based on the active terminal instance's location rather than whether the active editor is a terminal editor. Remove the duplicate terminalEditorActive management from TerminalService since TerminalEditorService already correctly manages this context key via onDidActiveEditorChange, which checks whether the active editor is a TerminalEditorInput. Closes microsoft#182979
rzhao271
approved these changes
Mar 26, 2026
Contributor
Author
|
The two failing checks (Linux / Electron, Linux / Browser) are transient CI infrastructure failures — the runner received a shutdown signal mid-test ( Could a maintainer please re-run the failed checks? Thank you! |
Collaborator
|
Our pipeline is broken atm |
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?
When both a terminal editor and a terminal panel are present, focusing the terminal panel incorrectly sets
terminalEditorActivetofalse, even though the active editor is still a terminal editor (activeEditor == terminalEditor). This creates an inconsistent state whereactiveEditoristerminalEditorbutterminalEditorActiveisfalse.Fixes #182979
What is the new behavior?
The
terminalEditorActivecontext key now correctly reflects whether the active editor is a terminal editor, regardless of which terminal instance is currently focused. Focusing a terminal in the panel no longer overwrites this context key.Additional context
The root cause was duplicate management of the
terminalEditorActivecontext key:TerminalEditorServicecorrectly sets it viaonDidActiveEditorChange, checking if the active editor is aTerminalEditorInputTerminalServiceincorrectly overwrote it viaonDidChangeActiveInstance, setting it based on the active terminal instance's target locationWhen a panel terminal was focused,
onDidChangeActiveInstancefired and setterminalEditorActivetofalse(because the active instance was in the panel), overriding the correct value fromTerminalEditorService.The fix removes the duplicate
terminalEditorActivemanagement fromTerminalService, leaving it solely toTerminalEditorServicewhich already handles it correctly.