Skip to content

Commit

Permalink
feat: allow to skip modal prompt in CI/test environment (#654)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mcanouil authored Feb 13, 2025
1 parent 9b4036a commit 46c6d38
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## 1.119.0 (unreleased)

- 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)

- Provide F1 help at cursor in Positron (<https://github.com/quarto-dev/quarto/pull/599>)
Expand Down
14 changes: 14 additions & 0 deletions apps/vscode/src/providers/editor/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,20 @@ export class VisualEditorProvider implements CustomTextEditorProvider {

// prompt the user
const kVisualModeConfirmed = "visualModeConfirmed";

// 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 => {
if (process.env[envVar] !== undefined) {
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 46c6d38

Please sign in to comment.