Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions news/changelog-1.8.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ All changes included in 1.8:

- ([#12627](https://github.com/quarto-dev/quarto-cli/issues/12627)): Don't actually install extension when user responds `yes` to first prompt but `no` to second.

### `create`

- ([#12965](https://github.com/quarto-dev/quarto-cli/issues/12965)): Prevent automatic opening of new editor sessions when creating projects in Posit Workbench context. The `--open` flag is now ignored in this environment to avoid issues with Workbench session management.

## Engines

### `jupyter`
Expand Down
15 changes: 14 additions & 1 deletion src/command/create/cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import { extensionArtifactCreator } from "./artifacts/extension.ts";
import { projectArtifactCreator } from "./artifacts/project.ts";
import { kEditorInfos, scanForEditors } from "./editor.ts";

import { isInteractiveTerminal } from "../../core/platform.ts";
import {
isInteractiveTerminal,
isPositWorkbench,
} from "../../core/platform.ts";
import { runningInCI } from "../../core/ci-info.ts";

import { Command } from "cliffy/command/mod.ts";
Expand Down Expand Up @@ -56,6 +59,16 @@ export const createCommand = new Command()
const isInteractive = isInteractiveTerminal() && !runningInCI();
const allowPrompt = isInteractive && !!options.prompt && !options.json;

// Specific case where opening automatically in an editor is not allowed
if (options.open !== false && isPositWorkbench()) {
if (options.open !== undefined) {
info(
`The --open option is not supported in Posit Workbench - ignoring`,
);
}
options.open = false;
}

// Resolve the type into an artifact
const resolved = await resolveArtifact(
type,
Expand Down
4 changes: 2 additions & 2 deletions src/command/preview/preview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ import {
safeExistsSync,
} from "../../core/path.ts";
import {
isPositWorkbench,
isRStudio,
isRStudioWorkbench,
isServerSession,
isVSCodeServer,
vsCodeServerProxyUri,
Expand Down Expand Up @@ -872,7 +872,7 @@ function pdfFileRequestHandler(
const onRequest = pdfOptions.onRequest;
pdfOptions.onRequest = async (req: Request) => {
if (new URL(req.url).pathname === "/") {
const url = isRStudioWorkbench()
const url = isPositWorkbench()
? await rswURL(port, kPdfJsInitialPath)
: isVSCodeServer()
? vsCodeServerProxyUri()!.replace("{{port}}", `${port}`) +
Expand Down
4 changes: 2 additions & 2 deletions src/core/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function isVSCodeServer() {
return !!vsCodeServerProxyUri();
}

export function isRStudioWorkbench() {
export function isPositWorkbench() {
// 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");
Expand All @@ -50,7 +50,7 @@ export function isPositronTerminal() {
}

export function isServerSession() {
return isRStudioServer() || isRStudioWorkbench() || isJupyterServer() ||
return isRStudioServer() || isPositWorkbench() || isJupyterServer() ||
isJupyterHubServer() || isVSCodeServer();
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/previewurl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import * as colors from "fmt/colors";
import {
isJupyterHubServer,
isJupyterServer,
isPositWorkbench,
isRStudioServer,
isRStudioWorkbench,
isVSCodeServer,
isVSCodeTerminal,
jupyterHubHttpReferrer,
Expand Down Expand Up @@ -58,7 +58,7 @@ export async function printBrowsePreviewMessage(
path: string,
) {
if (
(isJupyterServer() || isVSCodeTerminal()) && isRStudioWorkbench()
(isJupyterServer() || isVSCodeTerminal()) && isPositWorkbench()
) {
const url = await rswURL(port, path);
info(`\nPreview server: ${previewURL(host, port, path = "")}`);
Expand Down