Skip to content

Commit f4ca413

Browse files
authored
Add --ignore-last-opened option (#2434)
This allows bypassing the last opened behavior for certain cases where that's not desirable. Fixes #1951
1 parent 7e05ca0 commit f4ca413

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/node/cli.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export interface Args extends VsArgs {
5252
"proxy-domain"?: string[]
5353
locale?: string
5454
_: string[]
55+
"ignore-last-opened"?: boolean
5556
"reuse-window"?: boolean
5657
"new-window"?: boolean
5758

@@ -171,7 +172,11 @@ const options: Options<Required<Args>> = {
171172
"uninstall-extension": { type: "string[]", description: "Uninstall a VS Code extension by id." },
172173
"show-versions": { type: "boolean", description: "Show VS Code extension versions." },
173174
"proxy-domain": { type: "string[]", description: "Domain used for proxying ports." },
174-
175+
"ignore-last-opened": {
176+
type: "boolean",
177+
short: "e",
178+
description: "Ignore the last opened directory or workspace in favor of an empty window."
179+
},
175180
"new-window": {
176181
type: "boolean",
177182
short: "n",

src/node/vscode.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class VscodeProvider {
4343
options.args._ && options.args._.length > 0
4444
? { url: path.resolve(options.args._[options.args._.length - 1]) }
4545
: undefined,
46-
lastVisited,
46+
!options.args["ignore-last-opened"] ? lastVisited : undefined,
4747
])
4848

4949
settings.write({

0 commit comments

Comments
 (0)