sessions - adopt modal editor support from core (#296585)

* sessions - adopt modal editor support from core

* Update src/vs/workbench/services/editor/test/browser/modalEditorGroup.test.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update .github/skills/agent-sessions-layout/SKILL.md

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Update src/vs/workbench/services/editor/common/editorGroupFinder.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Benjamin Pasero
2026-02-20 20:47:52 +01:00
committed by GitHub
parent daddf4fcae
commit 73e3dbe7a2
15 changed files with 186 additions and 453 deletions

View File

@@ -140,6 +140,7 @@ function f(x: number, y: string): void { }
- Do not duplicate code. Always look for existing utility functions, helpers, or patterns in the codebase before implementing new functionality. Reuse and extend existing code whenever possible.
- You MUST deal with disposables by registering them immediately after creation for later disposal. Use helpers such as `DisposableStore`, `MutableDisposable` or `DisposableMap`. Do NOT register a disposable to the containing class if the object is created within a method that is called repeadedly to avoid leaks. Instead, return a `IDisposable` from such method and let the caller register it.
- You MUST NOT use storage keys of another component only to make changes to that component. You MUST come up with proper API to change another component.
- Use `IEditorService` to open editors instead of `IEditorGroupsService.activeGroup.openEditor` to ensure that the editor opening logic is properly followed and to avoid bypassing important features such as `revealIfOpened` or `preserveFocus`.
## Learnings
- Minimize the amount of assertions in tests. Prefer one snapshot-style `assert.deepStrictEqual` over multiple precise assertions, as they are much more difficult to understand and to update.

View File

@@ -61,7 +61,6 @@ When proposing or implementing changes, follow these rules from the spec:
| `sessions/browser/style.css` | Layout-specific styles |
| `sessions/browser/parts/` | Agent session part implementations |
| `sessions/browser/parts/titlebarPart.ts` | Titlebar part, MainTitlebarPart, AuxiliaryTitlebarPart, TitleService |
| `sessions/browser/parts/editorModal.ts` | Editor modal overlay |
| `sessions/browser/parts/sidebarPart.ts` | Sidebar part (with footer) |
| `sessions/browser/parts/chatBarPart.ts` | Chat Bar part |
| `sessions/browser/widget/` | Agent sessions chat widget |
@@ -76,5 +75,5 @@ After modifying layout code:
1. Verify the build compiles without errors via the `VS Code - Build` task
2. Ensure the grid structure matches the spec's visual representation
3. Confirm part visibility toggling works correctly (show/hide/maximize)
4. Test the editor modal opens/closes properly on editor events
4. Test that editors open in the `ModalEditorPart` overlay and that it closes properly
5. Verify sidebar footer renders with account widget

View File

@@ -84,7 +84,6 @@ src/vs/sessions/
│ ├── auxiliaryBarPart.ts # Auxiliary Bar (with run script dropdown)
│ ├── panelPart.ts # Panel (terminal, output, etc.)
│ ├── projectBarPart.ts # Project bar (folder entries)
│ ├── editorModal.ts # Editor modal overlay
│ ├── agentSessionsChatInputPart.ts # Chat input part adapter
│ ├── agentSessionsChatWelcomePart.ts # Welcome view (mascot + target buttons + pickers)
│ └── media/ # Part CSS files
@@ -134,13 +133,13 @@ Use the `agent-sessions-layout` skill for detailed guidance on the layout. Key p
| Chat Bar | Visible | Primary chat widget |
| Auxiliary Bar | Visible | Changes view, etc. |
| Panel | Hidden | Terminal, output |
| Editor | Hidden | Modal overlay, auto-shows on editor open |
| Editor | Hidden | Main part hidden; editors open via `MODAL_GROUP` into `ModalEditorPart` |
**Not included:** Activity Bar, Status Bar, Banner.
### 4.3 Editor Modal
Editors appear as modal overlays (80% of workbench, min 400×300, max 1200×900). The modal auto-shows when an editor opens and auto-hides when all editors close. Click backdrop, press Escape, or click X to dismiss.
The main editor part is hidden (`display:none`). All editors open via `MODAL_GROUP` into the standard `ModalEditorPart` overlay (created on-demand by `EditorParts.createModalEditorPart`). The sessions configuration sets `workbench.editor.useModal` to `'on'`, which causes `findGroup()` to redirect all editor opens to the modal. Click backdrop or press Escape to dismiss.
## 5. Chat Widget