diff --git a/apps/vscode/CHANGELOG.md b/apps/vscode/CHANGELOG.md index cc090140..cfce78e4 100644 --- a/apps/vscode/CHANGELOG.md +++ b/apps/vscode/CHANGELOG.md @@ -2,7 +2,7 @@ ## 1.119.0 (unreleased) -- Use `CI=true` or `QUARTO_VISUAL_EDITOR_CONFIRMED=true` to bypass the Visual Editor confirmation dialogue (). +- Use `QUARTO_VISUAL_EDITOR_CONFIRMED` > `PW_TEST` > `CI` to bypass (`true`) or force (`false`) the Visual Editor confirmation dialogue (). ## 1.118.0 (Release on 2024-11-26) diff --git a/apps/vscode/src/providers/editor/editor.ts b/apps/vscode/src/providers/editor/editor.ts index 64c242f4..1984d691 100644 --- a/apps/vscode/src/providers/editor/editor.ts +++ b/apps/vscode/src/providers/editor/editor.ts @@ -327,9 +327,22 @@ export class VisualEditorProvider implements CustomTextEditorProvider { // prompt the user const kVisualModeConfirmed = "visualModeConfirmed"; - if (process.env.CI === "true" || process.env.QUARTO_VISUAL_EDITOR_CONFIRMED === "true") { - this.context.globalState.update(kVisualModeConfirmed, true); - } + + // Check for environment variables to force the state of the visual editor confirmation modal + // QUARTO_VISUAL_EDITOR_CONFIRMED > PW_TEST > CI + const envVars = [ + "CI", + "PW_TEST", + "QUARTO_VISUAL_EDITOR_CONFIRMED" + ]; + envVars.forEach(envVar => { + console.log(`Checking for environment variable: ${envVar}`); + if (process.env[envVar] !== undefined) { + console.log(`Setting visual mode confirmation to ${process.env[envVar] === "true"}`); + this.context.globalState.update(kVisualModeConfirmed, process.env[envVar] === "true"); + } + }); + if (this.context.globalState.get(kVisualModeConfirmed) !== true) { const kUseVisualMode = "Use Visual Mode"; const kLearnMore = "Learn More...";