Skip to content
Merged
Changes from 1 commit
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
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,
isRStudioWorkbench,
} 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 && 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.

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
Loading