Skip to content

Conversation

@cderv
Copy link
Collaborator

@cderv cderv commented Jun 20, 2025

closes #12965

@jthomasmock, @MariaSemple, this is simple tweak to force --no-open when inside workbench.
I added info message in case a user is explicitly setting --open <editor name> to explain this is not permitted.

I'll manually test it somewhere I can access.

Is there any other specific behavior it should have in the Workbench context? Should we open automatically or prompt to open, but in a different way?

You can also test this PR by cloning, switching branch and installing from source Quarto dev version

@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Jun 20, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

@cderv
Copy link
Collaborator Author

cderv commented Jun 20, 2025

Tested manually on Posit workbench - No new window opened.

$ ./package/dist/bin/quarto create 
Check file:///mnt/home/cderv/quarto-cli/src/quarto.ts
? Create › project
? Type › default
? Directory › ../testing-3
? Title (../testing-3) › Test
Creating project at /mnt/home/cderv/testing-3:
  - Created _quarto.yml
  - Created Test.qmd
$ ./package/dist/bin/quarto create --open vscode
The --open option is not supported in Posit Workbench - ignoring
? Create › project
? Type › default
? Directory › ../testing-4
? Title (../testing-4) › test
Creating project at /mnt/home/cderv/testing-4:
  - Created _quarto.yml
  - Created test.qmd

Copy link

@jthomasmock jthomasmock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM other than a minor nit about RStudio Workbench vs Posit Workbench.

const allowPrompt = isInteractive && !!options.prompt && !options.json;

// Specific case where opening automatically in an editor is not allowed
if (options.open !== false && isRStudioWorkbench()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit and this might be an older boolean, but isPositWorkbench would be more appropriate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes this is an older function

export function isRStudioWorkbench() {
// RS_SERVER_URL e.g. https://daily-rsw.soleng.rstudioservices.com/
// RS_SESSION_URL e.g. /s/eae053c9ab5a71168ee19/
return !!Deno.env.get("RS_SERVER_URL") && !!Deno.env.get("RS_SESSION_URL");
}

I did not bother renaming, but I can for sure.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cderv cderv merged commit 01cbc17 into main Jun 20, 2025
2 checks passed
@cderv cderv deleted the workbench-no-open branch June 20, 2025 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

quarto create should not automatically open new positron window when inside workbench

4 participants