Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
6 changes: 6 additions & 0 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import * as vscode from "vscode";
import * as ws from "ws";
import { errToStr } from "./api-helper";
import { CertificateError } from "./error";
import { FeatureSet } from "./featureSet";
import { getHeaderArgs } from "./headers";
import { getProxyForUrl } from "./proxy";
import { Storage } from "./storage";
Expand Down Expand Up @@ -174,6 +175,7 @@ export async function startWorkspaceIfStoppedOrFailed(
binPath: string,
workspace: Workspace,
writeEmitter: vscode.EventEmitter<string>,
featureSet: FeatureSet,
): Promise<Workspace> {
// Before we start a workspace, we make an initial request to check it's not already started
const updatedWorkspace = await restClient.getWorkspace(workspace.id);
Expand All @@ -191,6 +193,10 @@ export async function startWorkspaceIfStoppedOrFailed(
"--yes",
workspace.owner_name + "/" + workspace.name,
];
if (featureSet.buildReason) {
startArgs.push(...["--reason", "vscode_connection"]);
}

const startProcess = spawn(binPath, startArgs);

startProcess.stdout.on("data", (data: Buffer) => {
Expand Down
6 changes: 6 additions & 0 deletions src/featureSet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export type FeatureSet = {
vscodessh: boolean;
proxyLogDirectory: boolean;
wildcardSSH: boolean;
buildReason: boolean;
};

/**
Expand All @@ -29,5 +30,10 @@ export function featureSetForVersion(
wildcardSSH:
(version ? version.compare("2.19.0") : -1) >= 0 ||
version?.prerelease[0] === "devel",

// --reason flag was added in 2.25.0
buildReason:
(version?.compare("2.25.0") || 0) >= 0 ||
version?.prerelease[0] === "devel",
};
}
4 changes: 4 additions & 0 deletions src/remote.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export class Remote {
workspace: Workspace,
label: string,
binPath: string,
featureSet: FeatureSet,
): Promise<Workspace | undefined> {
const workspaceName = `${workspace.owner_name}/${workspace.name}`;

Expand Down Expand Up @@ -140,6 +141,7 @@ export class Remote {
binPath,
workspace,
writeEmitter,
featureSet,
);
break;
case "failed":
Expand All @@ -159,6 +161,7 @@ export class Remote {
binPath,
workspace,
writeEmitter,
featureSet,
);
break;
}
Expand Down Expand Up @@ -393,6 +396,7 @@ export class Remote {
workspace,
parts.label,
binaryPath,
featureSet,
);
if (!updatedWorkspace) {
// User declined to start the workspace.
Expand Down