microsoft / microsoft/vscode

Report Issue wizard resets when its editor tab is moved to another group

Open
#336,438 1 comment 0 reactions 1 assignee Claimed by @Giuspepe View on GitHub
bug workbench-tabs
Dominant language
TypeScript
Stars
193k
Forks
42.4k
PR merge metrics
PR metrics pending

Description

### Steps to reproduce

1. Open **Help: Report Issue** in the editor area.
2. Capture a screenshot and click its thumbnail to open the screenshot annotation view.
3. Drag the **Report Issue** tab toward the bottom of its editor group to create a horizontal split.

### Expected

The Report Issue editor keeps the same wizard/view state after it moves. In this case, the screenshot annotation view remains open with the same in-progress annotation state.

### Actual

The moved tab shows a newly-created wizard on **Step 1 of 3 / Attachments**. The screenshot remains attached, but the annotation view is closed. The same pane recreation also resets wizard state that is not mirrored onto the editor input (step, draft fields/selections, diagnostics toggles, preview state, and any unsaved annotation edits).

Reproduced on VS Code Insiders commit [`7debcd0e2acdea1c52de81bf9ee1620444407dda`](https://github.com/microsoft/vscode/commit/7debcd0e2acdea1c52de81bf9ee1620444407dda) using `@hediet/dbgjs` Playwright support.

The automated probe observed:

```json
{
"before": {
"groups": 1,
"annotationCanvases": 1
},
"after": {
"groups": 2,
"annotationCanvases": 0,
"wizardReplaced": true,
"previousWizardConnected": false,
"previousAnnotationConnected": false,
"attachmentPreserved": true,
"attachmentsStepVisible": true
}
}
```

### Root cause

Moving the editor to another group creates a new `IssueReporterEditorPane`. Its [`setInput()`](https://github.com/microsoft/vscode/blob/7debcd0e2acdea1c52de81bf9ee1620444407dda/src/vs/workbench/contrib/issue/electron-browser/issueReporterEditorPane.ts#L137-L215) constructs a fresh `IssueReporterOverlay`.

The overlay initializes [`currentStep` to `WizardStep.Attachments`](https://github.com/microsoft/vscode/blob/7debcd0e2acdea1c52de81bf9ee1620444407dda/src/vs/workbench/contrib/issue/browser/issueReporterOverlay.ts#L143-L195). The shared [`IssueReporterEditorInput`](https://github.com/microsoft/vscode/blob/7debcd0e2acdea1c52de81bf9ee1620444407dda/src/vs/workbench/contrib/issue/browser/issueReporterEditorInput.ts#L19-L39) only persists screenshots and recordings, so `restoreAttachmentsFromInput()` restores the image but not the rest of the wizard state.

The annotation editor is local to the overlay and is only created by [`openAnnotationEditor()`](https://github.com/microsoft/vscode/blob/7debcd0e2acdea1c52de81bf9ee1620444407dda/src/vs/workbench/contrib/issue/browser/issueReporterOverlay.ts#L2120-L2145). Its annotation state is copied back to the screenshot only on Save, so disposing the old pane while editing also drops in-progress edits.

### Proposed fix

Make `IssueReporterEditorInput` the source of truth for the complete restorable wizard state, not only attachments:

1. Add an `IIssueReporterEditorState` captured/restored by `IssueReporterOverlay` (current step, form draft/selections, diagnostics toggles, preview state, attachments, and active annotation editor state/index).
2. Emit a state-change event for user-visible/draft mutations and mirror the latest snapshot onto the input. Also take a final snapshot before the old pane/wizard is disposed.
3. Pass the saved state when constructing the replacement overlay and reopen the active annotation editor after the attachments have been restored.
4. For an annotation editor that is currently open, expose/capture its current `IAnnotationEditorState` before disposal rather than waiting for Save.
5. Add an editor integration test that moves the singleton input between groups while on each wizard step and while annotating, asserting that the DOM view and draft values are preserved.

This should replace the attachment-only persistence path with one coherent editor state path and also cover moves between the main editor area and the Agents Window modal editor part.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.