From f4ca41329a0c5ceb4d6c4af7a69926a9227e90f3 Mon Sep 17 00:00:00 2001 From: JammSpread <61063879+JammSpread@users.noreply.github.com> Date: Tue, 15 Dec 2020 11:22:58 -0500 Subject: [PATCH] Add --ignore-last-opened option (#2434) This allows bypassing the last opened behavior for certain cases where that's not desirable. Fixes #1951 --- src/node/cli.ts | 7 ++++++- src/node/vscode.ts | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/node/cli.ts b/src/node/cli.ts index 209c86a13..3fae9adbc 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -52,6 +52,7 @@ export interface Args extends VsArgs { "proxy-domain"?: string[] locale?: string _: string[] + "ignore-last-opened"?: boolean "reuse-window"?: boolean "new-window"?: boolean @@ -171,7 +172,11 @@ const options: Options> = { "uninstall-extension": { type: "string[]", description: "Uninstall a VS Code extension by id." }, "show-versions": { type: "boolean", description: "Show VS Code extension versions." }, "proxy-domain": { type: "string[]", description: "Domain used for proxying ports." }, - + "ignore-last-opened": { + type: "boolean", + short: "e", + description: "Ignore the last opened directory or workspace in favor of an empty window." + }, "new-window": { type: "boolean", short: "n", diff --git a/src/node/vscode.ts b/src/node/vscode.ts index 3c18cdee6..e382d59b2 100644 --- a/src/node/vscode.ts +++ b/src/node/vscode.ts @@ -43,7 +43,7 @@ export class VscodeProvider { options.args._ && options.args._.length > 0 ? { url: path.resolve(options.args._[options.args._.length - 1]) } : undefined, - lastVisited, + !options.args["ignore-last-opened"] ? lastVisited : undefined, ]) settings.write({