Skip to content

Commit 46c6d38

Browse files
authored
feat: allow to skip modal prompt in CI/test environment (#654)
* ci: if CI is set don't prompt for modal * chore: add changelog entry * chore: add pr id to changelog entry * fix: add `QUARTO_VISUAL_EDITOR_CONFIRMED=true` * fix: add more levels of control for the modal * chore: cleanup log
1 parent 9b4036a commit 46c6d38

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
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.119.0 (unreleased)
44

5+
- Use `QUARTO_VISUAL_EDITOR_CONFIRMED` > `PW_TEST` > `CI` to bypass (`true`) or force (`false`) the Visual Editor confirmation dialogue (<https://github.com/quarto-dev/quarto/pull/654>).
6+
57
## 1.118.0 (Release on 2024-11-26)
68

79
- Provide F1 help at cursor in Positron (<https://github.com/quarto-dev/quarto/pull/599>)

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,20 @@ export class VisualEditorProvider implements CustomTextEditorProvider {
327327

328328
// prompt the user
329329
const kVisualModeConfirmed = "visualModeConfirmed";
330+
331+
// Check for environment variables to force the state of the visual editor confirmation modal
332+
// QUARTO_VISUAL_EDITOR_CONFIRMED > PW_TEST > CI
333+
const envVars = [
334+
"CI",
335+
"PW_TEST",
336+
"QUARTO_VISUAL_EDITOR_CONFIRMED"
337+
];
338+
envVars.forEach(envVar => {
339+
if (process.env[envVar] !== undefined) {
340+
this.context.globalState.update(kVisualModeConfirmed, process.env[envVar] === "true");
341+
}
342+
});
343+
330344
if (this.context.globalState.get(kVisualModeConfirmed) !== true) {
331345
const kUseVisualMode = "Use Visual Mode";
332346
const kLearnMore = "Learn More...";

0 commit comments

Comments
 (0)