Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## 1.123.0 (unreleased)

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

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

Expand Down
2 changes: 1 addition & 1 deletion apps/vscode/src/providers/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class VisualEditorProvider implements CustomTextEditorProvider {
// as the tab in `window.tabGroups`, so if we try and close `tab` we
// get a "tab not found" error. The one we care about does exist, but we have
// manually find it via URI, which is a stable field to match on.
if (editorMode && editorMode != viewType && !isSwitch) {
if (editorMode && editorMode !== viewType && !isSwitch) {
const allTabs = window.tabGroups.all.flatMap(group => group.tabs);

// find tab to close if swapping editor type
Expand Down
5 changes: 5 additions & 0 deletions apps/vscode/src/providers/editor/toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ export async function reopenEditorInVisualMode(
viewColumn?: ViewColumn
) {
if (hasHooks()) {
// note pending switch to visual
VisualEditorProvider.recordPendingSwitchToVisual(document);
commands.executeCommand('positron.reopenWith', document.uri, 'quarto.visualEditor');
} else {
// save then close
Expand All @@ -144,6 +146,9 @@ export async function reopenEditorInSourceMode(
viewColumn?: ViewColumn
) {
if (hasHooks()) {
// note pending switch to source
VisualEditorProvider.recordPendingSwitchToSource(document);

commands.executeCommand('positron.reopenWith', document.uri, 'default');
} else {
if (!document.isUntitled) {
Expand Down