Skip to content

Commit

Permalink
fix: add more levels of control for the modal
Browse files Browse the repository at this point in the history
  • Loading branch information
mcanouil committed Feb 11, 2025
1 parent 7ef1497 commit 710daf4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apps/vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 1.119.0 (unreleased)

- Use `CI=true` or `QUARTO_VISUAL_EDITOR_CONFIRMED=true` to bypass the Visual Editor confirmation dialogue (<https://github.com/quarto-dev/quarto/pull/654>).
- 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>).

## 1.118.0 (Release on 2024-11-26)

Expand Down
19 changes: 16 additions & 3 deletions apps/vscode/src/providers/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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...";
Expand Down

0 comments on commit 710daf4

Please sign in to comment.