Skip to content

Commit 16ead3c

Browse files
authored
Undo onDidSaveTextDocument that causes problems for ALL files in VS Code (#848)
* Undo `onDidSaveTextDocument` that causes problems for _all_ files * Update changelog
1 parent c1b6c27 commit 16ead3c

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

apps/vscode/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## 1.126.0 (Unreleased)
44

5+
- Fixed a bug opening non-Quarto files in visual mode on saving (<https://github.com/quarto-dev/quarto/pull/848>).
6+
57
## 1.125.0 (Release on 2025-09-03)
68

79
- Fixed an issue where attribute values containing '='s could be truncated in some scenarios (<https://github.com/quarto-dev/quarto/pull/814>).

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,18 @@ export async function reopenEditorInVisualMode(
129129
// reopen in visual mode
130130
commands.executeCommand('positron.reopenWith', document.uri, 'quarto.visualEditor');
131131
} else {
132-
workspace.onDidSaveTextDocument(async (doc: TextDocument) => {
133-
// open in visual mode
134-
VisualEditorProvider.recordPendingSwitchToVisual(doc);
135-
await commands.executeCommand('workbench.action.closeActiveEditor');
136-
await commands.executeCommand("vscode.openWith",
137-
doc.uri,
138-
VisualEditorProvider.viewType,
139-
{ viewColumn }
140-
);
141-
});
142-
// save, which will trigger `onDidSaveTextDocument`
132+
// save then close
143133
await commands.executeCommand("workbench.action.files.save");
134+
await commands.executeCommand('workbench.action.closeActiveEditor');
135+
VisualEditorProvider.recordPendingSwitchToVisual(document);
136+
137+
// open in visual mode
138+
await commands.executeCommand(
139+
"vscode.openWith",
140+
document.uri,
141+
VisualEditorProvider.viewType,
142+
{ viewColumn }
143+
);
144144
}
145145
}
146146

0 commit comments

Comments
 (0)