From 288e794c99c1b6579a40733407fbce2c9944d452 Mon Sep 17 00:00:00 2001 From: Asher Date: Thu, 20 Feb 2020 12:38:46 -0600 Subject: [PATCH] Update locale file location Should make language packs work again. --- ci/build.ts | 12 ++++++------ ci/vscode.patch | 26 +++++++++++++++----------- src/node/cli.ts | 1 + 3 files changed, 22 insertions(+), 17 deletions(-) diff --git a/ci/build.ts b/ci/build.ts index fa7f01ed..0026e2c5 100644 --- a/ci/build.ts +++ b/ci/build.ts @@ -457,18 +457,18 @@ class Builder { } let startingVscode = false + let startedVscode = false onLine(vscode, (line, original) => { console.log("[vscode]", original) // Wait for watch-client since "Finished compilation" will appear multiple // times before the client starts building. if (!startingVscode && line.includes("Starting watch-client")) { startingVscode = true - } else if (startingVscode && line.includes("Finished compilation") && process.env.AUTO_PATCH) { - cp.exec("yarn patch:generate", { cwd: this.rootPath }, (error, _, stderr) => { - if (error || stderr) { - console.error(error ? error.message : stderr) - } - }) + } else if (startingVscode && line.includes("Finished compilation")) { + if (startedVscode) { + bundle.then(restartServer) + } + startedVscode = true } }) diff --git a/ci/vscode.patch b/ci/vscode.patch index 4d9e2c32..1d6996f7 100644 --- a/ci/vscode.patch +++ b/ci/vscode.patch @@ -985,10 +985,10 @@ index 0000000000..56331ff1fc +require('../../bootstrap-amd').load('vs/server/entry'); diff --git a/src/vs/server/ipc.d.ts b/src/vs/server/ipc.d.ts new file mode 100644 -index 0000000000..82566066ff +index 0000000000..a0d1d0df54 --- /dev/null +++ b/src/vs/server/ipc.d.ts -@@ -0,0 +1,106 @@ +@@ -0,0 +1,108 @@ +/** + * External interfaces for integration into code-server over IPC. No vs imports + * should be made in this file. @@ -1039,6 +1039,8 @@ index 0000000000..82566066ff + 'extra-extensions-dir'?: string[]; + 'extra-builtin-extensions-dir'?: string[]; + ++ locale?: string ++ + log?: string; + verbose?: boolean; + @@ -1995,10 +1997,10 @@ index 0000000000..8956fc40d4 +}; diff --git a/src/vs/server/node/nls.ts b/src/vs/server/node/nls.ts new file mode 100644 -index 0000000000..61c79d0d80 +index 0000000000..3d428a57d3 --- /dev/null +++ b/src/vs/server/node/nls.ts -@@ -0,0 +1,86 @@ +@@ -0,0 +1,88 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import * as util from 'util'; @@ -2052,13 +2054,15 @@ index 0000000000..61c79d0d80 +}; + +export const getLocaleFromConfig = async (userDataPath: string): Promise => { -+ let locale = 'en'; -+ try { -+ const localeConfigUri = path.join(userDataPath, 'User/locale.json'); -+ const content = stripComments(await util.promisify(fs.readFile)(localeConfigUri, 'utf8')); -+ locale = JSON.parse(content).locale; -+ } catch (error) { /* Ignore. */ } -+ return locale; ++ const files = ['locale.json', 'argv.json']; ++ for (let i = 0; i < files.length; ++i) { ++ try { ++ const localeConfigUri = path.join(userDataPath, 'User', files[i]); ++ const content = stripComments(await util.promisify(fs.readFile)(localeConfigUri, 'utf8')); ++ return JSON.parse(content).locale; ++ } catch (error) { /* Ignore. */ } ++ } ++ return 'en'; +}; + +// Taken from src/main.js in the main VS Code source. diff --git a/src/node/cli.ts b/src/node/cli.ts index 81ff0393..028a28a6 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -102,6 +102,7 @@ const options: Options> = { "install-extension": { type: "string[]" }, "uninstall-extension": { type: "string[]" }, + locale: { type: "string" }, log: { type: LogLevel }, verbose: { type: "boolean", short: "vvv", description: "Enable verbose logging." }, }