Skip to content

Commit a673cf2

Browse files
committed
refactor: shouldRunVsCodeCli
1 parent 30ade71 commit a673cf2

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/node/cli.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,20 @@ function bindAddrFromAllSources(...argsConfig: Args[]): Addr {
626626
}
627627

628628
export const shouldRunVsCodeCli = (args: Args): boolean => {
629-
return !!args["list-extensions"] || !!args["install-extension"] || !!args["uninstall-extension"]
629+
// Create new interface with only these keys
630+
// Pick<Args, "list-extensions" | "install-extension" | "uninstall-extension">
631+
// Get the keys of new interface
632+
// keyof ...
633+
// Turn that into an array
634+
// Array<...>
635+
type ExtensionArgs = Array<keyof Pick<Args, "list-extensions" | "install-extension" | "uninstall-extension">>
636+
const extensionRelatedArgs: ExtensionArgs = ["list-extensions", "install-extension", "uninstall-extension"]
637+
638+
const argKeys = Object.keys(args)
639+
640+
// If any of the extensionRelatedArgs are included in args
641+
// then we don't want to run the vscode cli
642+
return extensionRelatedArgs.some((arg) => argKeys.includes(arg))
630643
}
631644

632645
/**

0 commit comments

Comments
 (0)