Skip to content

Commit 61b7dad

Browse files
authored
Record pending switches to source/visual in Positron (#732)
* Record pending switches for visual/source mode in Positron * Make linter happy * Update changelog
1 parent cddc812 commit 61b7dad

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

apps/vscode/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## 1.123.0 (unreleased)
44

5+
- Fixed a bug with switching between source and visual editors in Positron (<https://github.com/quarto-dev/quarto/pull/732>).
56

67
## 1.122.0 (Release on 2025-05-26)
78

apps/vscode/src/providers/editor/editor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ export class VisualEditorProvider implements CustomTextEditorProvider {
175175
// as the tab in `window.tabGroups`, so if we try and close `tab` we
176176
// get a "tab not found" error. The one we care about does exist, but we have
177177
// manually find it via URI, which is a stable field to match on.
178-
if (editorMode && editorMode != viewType && !isSwitch) {
178+
if (editorMode && editorMode !== viewType && !isSwitch) {
179179
const allTabs = window.tabGroups.all.flatMap(group => group.tabs);
180180

181181
// find tab to close if swapping editor type

apps/vscode/src/providers/editor/toggle.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,8 @@ export async function reopenEditorInVisualMode(
121121
viewColumn?: ViewColumn
122122
) {
123123
if (hasHooks()) {
124+
// note pending switch to visual
125+
VisualEditorProvider.recordPendingSwitchToVisual(document);
124126
commands.executeCommand('positron.reopenWith', document.uri, 'quarto.visualEditor');
125127
} else {
126128
// save then close
@@ -144,6 +146,9 @@ export async function reopenEditorInSourceMode(
144146
viewColumn?: ViewColumn
145147
) {
146148
if (hasHooks()) {
149+
// note pending switch to source
150+
VisualEditorProvider.recordPendingSwitchToSource(document);
151+
147152
commands.executeCommand('positron.reopenWith', document.uri, 'default');
148153
} else {
149154
if (!document.isUntitled) {

0 commit comments

Comments
 (0)