[AIR #1074] vscode: align backlog issue-preview placement with count-then-pick (remove focus side-effect)#1076
Merged
Merged
Conversation
…pattern Replace the focusFirstEditorGroup + markdown.showPreviewToSide dance in view-issue.ts with an explicit count-then-pick that opens the built-in markdown preview via vscode.openWith. The built-in markdown.showPreview / showPreviewToSide commands anchor the preview to the active editor group and ignore any column argument, so the old code force-focused group 1 to make Beside resolve to group 2 - a focus side-effect that stole focus from the click origin and chained previews into groups 3/4/5 if any caller skipped the focus step. vscode.openWith with viewType vscode.markdown.preview.editor (VS Code's built-in preview custom editor, distinct from Codev's codev.markdownPreview canvas - so no overlap with #1068) accepts an explicit ViewColumn plus { preserveFocus: true }. Placement is now deterministic (group 2 when a second group exists, else group 1), focus stays on the backlog row, and there is no Beside-chaining or group-1-closed fragility. Adds pickIssuePreviewColumn(groupCount) + a unit test for the decision logic. Cache / refresh / close-cleanup behavior is untouched.
amrmelsayed
added a commit
that referenced
this pull request
Jun 18, 2026
CHANGELOG.md: Bug fixes (focus-stealing + group-chaining fix). UNRELEASED.md: Polish bullet (small consistency item, AIR-sized). Both clarify the placement change does not migrate off the built-in markdown preview - that's a separate decision in #1068.
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.
Summary
Aligns the backlog issue-preview placement with the count-then-pick pattern the builder/shell terminals already use (
Bugfix #804), removing the focus side-effect thatview-issue.tspreviously relied on.The old code (
view-issue.ts:173-174) did a two-step dance:It worked only because focusing group 1 first pinned
Besideto group 2. That stole focus from wherever the user was sitting and, if any caller skipped the focus step, chained previews into groups 3/4/5.Key decision: corrected API path
The issue proposed
markdown.showPreview(uri, viewColumn, preserveFocus). I verified against the bundled VS Code 1.124.2 markdown extension that this command does not accept an explicitviewColumnand has nopreserveFocusparameter —ShowPreviewCommand.execute(mainUri, allUris, {locked})hardcodessideBySide: falseand always opens in the active editor group. I surfaced this to the architect rather than coding against the wrong signature.The architect directed the corrected approach: open the built-in preview's custom-editor viewType via
vscode.openWith, which does accept an explicitViewColumn+TextDocumentShowOptions:vscode.markdown.preview.editoris VS Code's built-in markdown preview (verified in themarkdown-language-featuresmanifest: priorityoption, selector*.md— ourcodev-issue:<id>.mdURI matches). It is distinct from Codev's owncodev.markdownPreviewartifact canvas, so this stays on the built-in renderer and does not overlap with artifact-canvas: revisit VSCode issue-preview migration once typography tokens (#1053) and comment system v2 (#1055) land (decision record) #1068.vscode.openWithprecedent already exists in the codebase:extension.ts:804,commands/view-artifact.ts:127.Changes
commands/view-issue.ts: dropfocusFirstEditorGroup; add the pure helperpickIssuePreviewColumn(groupCount)(group 2 when>= 2, else group 1 — if/else, mirroringterminal-manager.ts); callvscode.openWithwith an explicit column +preserveFocus: true.src/__tests__/view-issue-column.test.ts: unit test for the column decision logic (mockedtabGroups.all.length→ 1/2/3/5/0), following thediff-nav.test.tsminimal-vscode-mock pattern.IssueContentProvider,OverviewCache.onDidChange,onDidCloseTextDocument) untouched.Acceptance criteria
workbench.action.focusFirstEditorGroup.viewColumnderived fromvscode.window.tabGroups.all.length.preserveFocus: true).Besidefragility (explicit column, notBeside).viewColumndecision logic.Test plan
pnpm check-types— cleaneslint src/commands/view-issue.ts src/__tests__/view-issue-column.test.ts— cleanpnpm test:unit(fullvitest run) — 35 files / 446 tests pass (incl. 4 new)Closes #1074.