Fix shortcuts/command palette commands not applying properly with popped out editors - #8925
Merged
Merged
Conversation
…ditor is popped out Every window (the main one and each popped out editor window) was sharing a single command manager. So the commands registered by the editors of all the windows were mixed together, and the first one registered for a given command name was the one kept (see `CommandManager.registerCommand`). Concretely: after popping out an events editor, pressing Shift+A in the main window added the new event in the popped out window instead of in the events editor displayed in the main window. Editors now register their commands in a command manager owned by the window displaying them, so a shortcut always runs the command of the window where it was pressed. Commands that are not editor specific (saving the project, launching a preview, opening a scene...) are still registered on the shared command manager, and stay reachable from every window. Also stop listening to the shortcuts sent by the in-game editor in the popped out windows: the in-game editor is displayed in the main window, which already handles them - otherwise they would have been run once per window. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012HSTVbvfgbj7UXLz5bcwCK
Wrap the window in its own command manager at the export of PoppedOutEditorContainerWindow, instead of in PoppedOutWindows: the isolation is a property of the popped out window itself, and this keeps PoppedOutWindows untouched. Also make the tests fail with a clear error when a command is missing, instead of comparing potentially null handlers. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012HSTVbvfgbj7UXLz5bcwCK
A component being unmounted or deactivated was removing its command from the manager by name only. If another component had registered the same command first (for example, two events editors in two panes), the deregistration was removing the command of this other component - leaving the shortcut doing nothing until the editor was remounted. Deregistration now passes the command object that was registered, and the manager only removes it if it's still the registered one. Deregistering by name only is still possible and keeps the previous behavior. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012HSTVbvfgbj7UXLz5bcwCK
- CommandsContextScopedProvider -> ActiveTabCommandsProvider: publishes the commands of a tab's editor only while the tab is the active one. - CommandsContextWindowProvider -> WindowCommandsProvider: isolates the commands of the editors of a window from the other windows. - ScopedCommandManager -> TabCommandManager, and its "_centralManager" is now "_windowCommandManager": a tab publishes its commands to the manager of its window (there is no central manager anymore). WindowCommandManager keeps its "_sharedCommandManager", which holds the commands shared by all the windows. No behavior change. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012HSTVbvfgbj7UXLz5bcwCK
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.
No description provided.