@@ -12,6 +12,8 @@ We can remove this once upstream supports all language packs.
12125. Add the locale flag.
13136. Remove the redundant locale verification. It does the same as the existing
1414 one but is worse because it does not handle non-existent or empty files.
15+ 7. Replace some caching and Node requires because code-server does not restart
16+ when changing the language unlike native Code.
1517
1618Index: code-server/lib/vscode/src/vs/server/node/serverServices.ts
1719===================================================================
@@ -312,3 +314,19 @@ Index: code-server/lib/vscode/src/vs/workbench/contrib/localization/electron-san
312314 await this.jsonEditingService.write(this.environmentService.argvResource, [{ path: ['locale'], value: locale }], true);
313315 return true;
314316 }
317+ Index: code-server/lib/vscode/src/vs/base/node/languagePacks.js
318+ ===================================================================
319+ --- code-server.orig/lib/vscode/src/vs/base/node/languagePacks.js
320+ +++ code-server/lib/vscode/src/vs/base/node/languagePacks.js
321+ @@ -73,7 +73,10 @@
322+ function getLanguagePackConfigurations(userDataPath) {
323+ const configFile = path.join(userDataPath, 'languagepacks.json');
324+ try {
325+ - return nodeRequire(configFile);
326+ + // This must not use Node's require otherwise it will be cached forever.
327+ + // Code can get away with this since the process actually restarts but
328+ + // that is not currently the case with code-server.
329+ + return JSON.parse(fs.readFileSync(configFile, "utf8"));
330+ } catch (err) {
331+ // Do nothing. If we can't read the file we have no
332+ // language pack config.
0 commit comments