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
3 changes: 2 additions & 1 deletion apps/vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
## 1.125.0 (Unreleased)

- Fixed an issue where attribute values containing '='s could be truncated in some scenarios (<https://github.com/quarto-dev/quarto/pull/814>).
- Fixed an issue where a loading spinner for qmd previews wasn't dismissed on preview errors (<https://github.com/quarto-dev/quarto/pull/823>)
- Fixed an issue where a loading spinner for qmd previews wasn't dismissed on preview errors (<https://github.com/quarto-dev/quarto/pull/823>).
- Diagnostics are no longer reported for internal temporary virtual document files (<https://github.com/quarto-dev/quarto/pull/832>).
- Fixed switching to visual mode for untitled documents in Positron (<https://github.com/quarto-dev/quarto/pull/831>).

## 1.124.0 (Release on 2025-08-20)

Expand Down
30 changes: 17 additions & 13 deletions apps/vscode/src/providers/editor/toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@
*
*/

import { commands, window, workspace, TextDocument, ViewColumn } from "vscode";
import { Uri, commands, window, workspace, TextDocument, ViewColumn } from "vscode";
import * as quarto from "quarto-core";
import { Command } from "../../core/command";
import { isQuartoDoc, kQuartoLanguageId } from "../../core/doc";
import { VisualEditorProvider } from "./editor";
import { Uri } from "vscode";
import { hasHooks } from "../../host/hooks";
import { toggleEditMode, toggleRenderOnSaveOverride } from "../context-keys";

Expand Down Expand Up @@ -123,20 +122,25 @@ export async function reopenEditorInVisualMode(
if (hasHooks()) {
// note pending switch to visual
VisualEditorProvider.recordPendingSwitchToVisual(document);
// if document is untitled, force user to save first
if (document.isUntitled) {
await commands.executeCommand("workbench.action.files.save");
}
// reopen in visual mode
commands.executeCommand('positron.reopenWith', document.uri, 'quarto.visualEditor');
} else {
// save then close
workspace.onDidSaveTextDocument(async (doc: TextDocument) => {
// open in visual mode
VisualEditorProvider.recordPendingSwitchToVisual(doc);
await commands.executeCommand('workbench.action.closeActiveEditor');
await commands.executeCommand("vscode.openWith",
doc.uri,
VisualEditorProvider.viewType,
{ viewColumn }
);
});
// save, which will trigger `onDidSaveTextDocument`
await commands.executeCommand("workbench.action.files.save");
await commands.executeCommand('workbench.action.closeActiveEditor');
VisualEditorProvider.recordPendingSwitchToVisual(document);
// open in visual mode
await commands.executeCommand("vscode.openWith",
document.uri,
VisualEditorProvider.viewType,
{
viewColumn
}
);
}
}

Expand Down