Skip to content

Commit c151c80

Browse files
committed
Force a user save on untitled documents, before switch to visual mode
1 parent 012d457 commit c151c80

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ export async function reopenEditorInVisualMode(
123123
if (hasHooks()) {
124124
// note pending switch to visual
125125
VisualEditorProvider.recordPendingSwitchToVisual(document);
126+
// if document is untitled, force user to save first
127+
if (document.isUntitled) {
128+
await commands.executeCommand("workbench.action.files.save");
129+
}
130+
// reopen in visual mode
126131
commands.executeCommand('positron.reopenWith', document.uri, 'quarto.visualEditor');
127132
} else {
128133
// save then close

0 commit comments

Comments
 (0)