Agents - maintain maximized state when opening in modal/main editor parts#311877
Agents - maintain maximized state when opening in modal/main editor parts#311877
Conversation
Screenshot ChangesBase: Changed (4) |
There was a problem hiding this comment.
Pull request overview
This PR aims to preserve the editor “maximized” state when switching between the main editor part and the modal editor part in the Agents (sessions) window.
Changes:
- Capture the main editor maximized state before moving editors into a modal editor part, and attempt to apply it to the modal.
- Capture the modal editor part’s maximized state before moving editors back to the main editor part, and attempt to apply it to the main layout.
- Refactor modal editor part access to use
activeModalEditorPart(part + group) rather than only the active group.
Show a summary per file
| File | Description |
|---|---|
| src/vs/sessions/contrib/editor/browser/editor.contribution.ts | Adds maximize-state capture/restore logic when moving editors between main and modal editor parts in the Agents window. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 2
| // Maximize | ||
| if (isMaximized) { |
There was a problem hiding this comment.
modalPart.toggleMaximized() is called based on the main layout’s isEditorMaximized() value, but modal editor parts can start already maximized (they remember maximized state across instances). In that case this unconditional toggle will invert the modal state and break the intended “inherit maximized state” behavior. Consider toggling only when modalPart.maximized !== isMaximized (or using modalPart.updateOptions({ maximized: isMaximized })).
| // Maximize | |
| if (isMaximized) { | |
| // Match the modal editor maximized state to the main editor maximized state | |
| if (modalPart.maximized !== isMaximized) { |
| // Maximize | ||
| if (isMaximized) { | ||
| layoutService.setEditorMaximized(true); | ||
| } |
There was a problem hiding this comment.
When switching from modal back to the main editor, the main editor maximized state is only set when isMaximized is true. If the main layout was maximized before opening the modal and the user un-maximizes the modal while it’s open, the main layout can remain maximized (sidebars/chatbar stay hidden) even though the modal wasn’t maximized on exit. Consider always syncing the main layout to the modal state via layoutService.setEditorMaximized(isMaximized) instead of only setting true conditionally.
| // Maximize | |
| if (isMaximized) { | |
| layoutService.setEditorMaximized(true); | |
| } | |
| // Sync the main editor layout to the modal maximized state | |
| layoutService.setEditorMaximized(isMaximized); |
No description provided.