Archived
1
0

Remove open-in flag (#2013)

This commit is contained in:
Asher 2020-08-27 15:04:37 -05:00 committed by GitHub
parent d8d5908d85
commit ce8577b1c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 12 deletions

View File

@ -26,7 +26,7 @@
"lint": "./ci/dev/lint.sh", "lint": "./ci/dev/lint.sh",
"test": "./ci/dev/test.sh", "test": "./ci/dev/test.sh",
"ci": "./ci/dev/ci.sh", "ci": "./ci/dev/ci.sh",
"watch": "NODE_OPTIONS=--max_old_space_size=32384 ts-node ./ci/dev/watch.ts" "watch": "VSCODE_IPC_HOOK_CLI= NODE_OPTIONS=--max_old_space_size=32384 ts-node ./ci/dev/watch.ts"
}, },
"main": "out/node/entry.js", "main": "out/node/entry.js",
"devDependencies": { "devDependencies": {

View File

@ -45,7 +45,6 @@ export interface Args extends VsArgs {
readonly "proxy-domain"?: string[] readonly "proxy-domain"?: string[]
readonly locale?: string readonly locale?: string
readonly _: string[] readonly _: string[]
readonly "open-in"?: boolean
readonly "reuse-window"?: boolean readonly "reuse-window"?: boolean
readonly "new-window"?: boolean readonly "new-window"?: boolean
} }
@ -142,7 +141,6 @@ const options: Options<Required<Args>> = {
"show-versions": { type: "boolean", description: "Show VS Code extension versions." }, "show-versions": { type: "boolean", description: "Show VS Code extension versions." },
"proxy-domain": { type: "string[]", description: "Domain used for proxying ports." }, "proxy-domain": { type: "string[]", description: "Domain used for proxying ports." },
"open-in": { type: "boolean", short: "oi", description: "Open file(s) or folder(s) in running instance" },
"new-window": { "new-window": {
type: "boolean", type: "boolean",
short: "n", short: "n",
@ -372,7 +370,7 @@ export async function readConfigFile(configPath?: string): Promise<Args> {
logger.info(`Wrote default config file to ${humanPath(configPath)}`) logger.info(`Wrote default config file to ${humanPath(configPath)}`)
} }
if (!process.env.CODE_SERVER_PARENT_PID) { if (!process.env.CODE_SERVER_PARENT_PID && !process.env.VSCODE_IPC_HOOK_CLI) {
logger.info(`Using config file ${humanPath(configPath)}`) logger.info(`Using config file ${humanPath(configPath)}`)
} }

View File

@ -164,14 +164,13 @@ async function entry(): Promise<void> {
console.log(version, commit) console.log(version, commit)
} }
process.exit(0) process.exit(0)
} else if (args["open-in"]) { } else if (process.env.VSCODE_IPC_HOOK_CLI) {
if (!process.env["VSCODE_IPC_HOOK_CLI"]) { const pipeArgs: OpenCommandPipeArgs = {
logger.error("VSCODE_IPC_HOOK_CLI missing from environment, unable to run") type: "open",
process.exit(1) folderURIs: [],
forceReuseWindow: args["reuse-window"],
forceNewWindow: args["new-window"],
} }
const pipeArgs: OpenCommandPipeArgs = { type: "open", folderURIs: [] }
pipeArgs.forceReuseWindow = args["reuse-window"]
pipeArgs.forceNewWindow = args["new-window"]
const isDir = async (path: string): Promise<boolean> => { const isDir = async (path: string): Promise<boolean> => {
try { try {
const st = await fs.stat(path) const st = await fs.stat(path)
@ -196,7 +195,7 @@ async function entry(): Promise<void> {
process.exit(1) process.exit(1)
} }
if (pipeArgs.folderURIs.length === 0 && (!pipeArgs.fileURIs || pipeArgs.fileURIs.length === 0)) { if (pipeArgs.folderURIs.length === 0 && (!pipeArgs.fileURIs || pipeArgs.fileURIs.length === 0)) {
logger.error("open-in expects at least one file or folder argument") logger.error("Please specify at least one file or folder argument")
process.exit(1) process.exit(1)
} }
const vscode = http.request( const vscode = http.request(