2022-03-23 04:07:14 +08:00
|
|
|
Prepare Code for integration with code-server
|
|
|
|
|
|
|
|
1. We already have the arguments so allow passing them in. There is also a
|
|
|
|
slight change in a few directories to preserve the directory structure we
|
|
|
|
have been using and to not override passed-in arguments.
|
2024-11-02 04:32:25 +08:00
|
|
|
2. Modify the entry point to allow importing the code, instead of just running
|
|
|
|
the server immediately.
|
|
|
|
3. Modify the terminal environment to filter out code-server environment variables.
|
|
|
|
4. Add the code-server version to the help dialog.
|
|
|
|
5. Add ready events for use in an iframe.
|
|
|
|
6. Add our icons and remove the existing ones.
|
|
|
|
7. Use our own manifest.
|
2022-03-23 04:07:14 +08:00
|
|
|
|
|
|
|
Index: code-server/lib/vscode/src/vs/server/node/server.main.ts
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/src/vs/server/node/server.main.ts
|
|
|
|
+++ code-server/lib/vscode/src/vs/server/node/server.main.ts
|
|
|
|
@@ -12,7 +12,7 @@ import { createServer as doCreateServer,
|
2024-10-18 12:31:28 +08:00
|
|
|
import { parseArgs, ErrorReporter } from '../../platform/environment/node/argv.js';
|
|
|
|
import { join, dirname } from '../../base/common/path.js';
|
2022-03-23 04:07:14 +08:00
|
|
|
import { performance } from 'perf_hooks';
|
2024-10-18 12:31:28 +08:00
|
|
|
-import { serverOptions } from './serverEnvironmentService.js';
|
|
|
|
+import { serverOptions, ServerParsedArgs } from './serverEnvironmentService.js';
|
|
|
|
import product from '../../platform/product/common/product.js';
|
|
|
|
import * as perf from '../../base/common/performance.js';
|
2022-03-23 04:07:14 +08:00
|
|
|
|
2024-11-02 04:32:25 +08:00
|
|
|
@@ -34,38 +34,47 @@ const errorReporter: ErrorReporter = {
|
2022-03-23 04:07:14 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
-const args = parseArgs(process.argv.slice(2), serverOptions, errorReporter);
|
|
|
|
+function parse(): ServerParsedArgs {
|
|
|
|
+ return parseArgs(process.argv.slice(2), serverOptions, errorReporter);
|
|
|
|
+}
|
|
|
|
|
|
|
|
-const REMOTE_DATA_FOLDER = args['server-data-dir'] || process.env['VSCODE_AGENT_FOLDER'] || join(os.homedir(), product.serverDataFolderName || '.vscode-remote');
|
|
|
|
-const USER_DATA_PATH = join(REMOTE_DATA_FOLDER, 'data');
|
|
|
|
-const APP_SETTINGS_HOME = join(USER_DATA_PATH, 'User');
|
|
|
|
-const GLOBAL_STORAGE_HOME = join(APP_SETTINGS_HOME, 'globalStorage');
|
2022-05-05 05:58:49 +08:00
|
|
|
-const LOCAL_HISTORY_HOME = join(APP_SETTINGS_HOME, 'History');
|
2022-03-23 04:07:14 +08:00
|
|
|
-const MACHINE_SETTINGS_HOME = join(USER_DATA_PATH, 'Machine');
|
|
|
|
-args['user-data-dir'] = USER_DATA_PATH;
|
2022-12-23 01:25:28 +08:00
|
|
|
-const APP_ROOT = dirname(FileAccess.asFileUri('').fsPath);
|
2022-03-23 04:07:14 +08:00
|
|
|
-const BUILTIN_EXTENSIONS_FOLDER_PATH = join(APP_ROOT, 'extensions');
|
|
|
|
-args['builtin-extensions-dir'] = BUILTIN_EXTENSIONS_FOLDER_PATH;
|
|
|
|
-args['extensions-dir'] = args['extensions-dir'] || join(REMOTE_DATA_FOLDER, 'extensions');
|
|
|
|
-
|
2022-05-05 05:58:49 +08:00
|
|
|
-[REMOTE_DATA_FOLDER, args['extensions-dir'], USER_DATA_PATH, APP_SETTINGS_HOME, MACHINE_SETTINGS_HOME, GLOBAL_STORAGE_HOME, LOCAL_HISTORY_HOME].forEach(f => {
|
2022-03-23 04:07:14 +08:00
|
|
|
- try {
|
|
|
|
- if (!fs.existsSync(f)) {
|
|
|
|
- fs.mkdirSync(f, { mode: 0o700 });
|
|
|
|
- }
|
|
|
|
- } catch (err) { console.error(err); }
|
|
|
|
-});
|
|
|
|
+function createDirs(args: ServerParsedArgs): string {
|
|
|
|
+ const REMOTE_DATA_FOLDER = args['server-data-dir'] || args['user-data-dir'] || process.env['VSCODE_AGENT_FOLDER'] || join(os.homedir(), product.serverDataFolderName || '.vscode-remote');
|
|
|
|
+ const USER_DATA_PATH = args['user-data-dir'] || join(REMOTE_DATA_FOLDER, 'data');
|
|
|
|
+ const APP_SETTINGS_HOME = join(USER_DATA_PATH, 'User');
|
|
|
|
+ const GLOBAL_STORAGE_HOME = join(APP_SETTINGS_HOME, 'globalStorage');
|
2022-05-05 05:58:49 +08:00
|
|
|
+ const LOCAL_HISTORY_HOME = join(APP_SETTINGS_HOME, 'History');
|
2022-03-23 04:07:14 +08:00
|
|
|
+ const MACHINE_SETTINGS_HOME = join(USER_DATA_PATH, 'Machine');
|
|
|
|
+ args['user-data-dir'] = USER_DATA_PATH;
|
2022-12-23 01:25:28 +08:00
|
|
|
+ const APP_ROOT = dirname(FileAccess.asFileUri('').fsPath);
|
2022-03-23 04:07:14 +08:00
|
|
|
+ const BUILTIN_EXTENSIONS_FOLDER_PATH = args['builtin-extensions-dir'] || join(APP_ROOT, 'extensions');
|
|
|
|
+ args['builtin-extensions-dir'] = BUILTIN_EXTENSIONS_FOLDER_PATH;
|
|
|
|
+ args['extensions-dir'] = args['extensions-dir'] || join(REMOTE_DATA_FOLDER, 'extensions');
|
|
|
|
+
|
2022-05-05 05:58:49 +08:00
|
|
|
+ [REMOTE_DATA_FOLDER, args['extensions-dir'], USER_DATA_PATH, APP_SETTINGS_HOME, MACHINE_SETTINGS_HOME, GLOBAL_STORAGE_HOME, LOCAL_HISTORY_HOME].forEach(f => {
|
2022-03-23 04:07:14 +08:00
|
|
|
+ try {
|
|
|
|
+ if (!fs.existsSync(f)) {
|
|
|
|
+ fs.mkdirSync(f, { mode: 0o700 });
|
|
|
|
+ }
|
|
|
|
+ } catch (err) { console.error(err); }
|
|
|
|
+ });
|
2022-05-05 05:58:49 +08:00
|
|
|
+ return REMOTE_DATA_FOLDER;
|
2022-03-23 04:07:14 +08:00
|
|
|
+}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* invoked by server-main.js
|
|
|
|
*/
|
|
|
|
-export function spawnCli() {
|
|
|
|
- runCli(args, REMOTE_DATA_FOLDER, serverOptions);
|
2024-11-02 04:32:25 +08:00
|
|
|
+function spawnCli(args = parse()): Promise<void> {
|
2022-03-23 04:07:14 +08:00
|
|
|
+ return runCli(args, createDirs(args), serverOptions);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* invoked by server-main.js
|
|
|
|
*/
|
|
|
|
-export function createServer(address: string | net.AddressInfo | null): Promise<IServerAPI> {
|
|
|
|
- return doCreateServer(address, args, REMOTE_DATA_FOLDER);
|
2024-11-02 04:32:25 +08:00
|
|
|
+function createServer(address: string | net.AddressInfo | null, args = parse()): Promise<IServerAPI> {
|
2022-03-23 04:07:14 +08:00
|
|
|
+ return doCreateServer(address, args, createDirs(args));
|
|
|
|
}
|
2024-11-02 04:32:25 +08:00
|
|
|
+
|
|
|
|
+// The aliases prevent the names getting mangled during minification which would
|
|
|
|
+// make it difficult to import.
|
|
|
|
+export { spawnCli as spawnCli, createServer as createServer };
|
2022-03-23 04:07:14 +08:00
|
|
|
Index: code-server/lib/vscode/src/vs/base/common/processes.ts
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/src/vs/base/common/processes.ts
|
|
|
|
+++ code-server/lib/vscode/src/vs/base/common/processes.ts
|
|
|
|
@@ -111,6 +111,8 @@ export function sanitizeProcessEnvironme
|
2023-05-16 07:44:03 +08:00
|
|
|
/^VSCODE_(?!(PORTABLE|SHELL_LOGIN|ENV_REPLACE|ENV_APPEND|ENV_PREPEND)).+$/,
|
2022-03-23 04:07:14 +08:00
|
|
|
/^SNAP(|_.*)$/,
|
|
|
|
/^GDK_PIXBUF_.+$/,
|
|
|
|
+ /^CODE_SERVER_.+$/,
|
|
|
|
+ /^CS_.+$/,
|
|
|
|
];
|
|
|
|
const envKeys = Object.keys(env);
|
|
|
|
envKeys
|
|
|
|
Index: code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
|
|
|
|
+++ code-server/lib/vscode/src/vs/workbench/browser/parts/dialogs/dialogHandler.ts
|
2023-05-16 07:44:03 +08:00
|
|
|
@@ -77,8 +77,11 @@ export class BrowserDialogHandler extend
|
2022-04-01 05:14:03 +08:00
|
|
|
|
2022-03-23 04:07:14 +08:00
|
|
|
async about(): Promise<void> {
|
|
|
|
const detailString = (useAgo: boolean): string => {
|
2022-04-01 05:14:03 +08:00
|
|
|
- return localize('aboutDetail',
|
2022-03-23 04:07:14 +08:00
|
|
|
- "Version: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
|
2022-04-01 05:14:03 +08:00
|
|
|
+ return localize('aboutCodeServerDetail',
|
|
|
|
+ "code-server: {0}",
|
|
|
|
+ this.productService.codeServerVersion ? `v${this.productService.codeServerVersion}` : 'Unknown'
|
|
|
|
+ ) + '\n' + localize('aboutDetail',
|
|
|
|
+ "Code: {0}\nCommit: {1}\nDate: {2}\nBrowser: {3}",
|
2022-03-23 04:07:14 +08:00
|
|
|
this.productService.version || 'Unknown',
|
|
|
|
this.productService.commit || 'Unknown',
|
|
|
|
this.productService.date ? `${this.productService.date}${useAgo ? ' (' + fromNow(new Date(this.productService.date), true) + ')' : ''}` : 'Unknown',
|
|
|
|
Index: code-server/lib/vscode/src/vs/workbench/browser/client.ts
|
|
|
|
===================================================================
|
|
|
|
--- /dev/null
|
|
|
|
+++ code-server/lib/vscode/src/vs/workbench/browser/client.ts
|
|
|
|
@@ -0,0 +1,46 @@
|
2024-10-18 12:31:28 +08:00
|
|
|
+import { Disposable } from "../../base/common/lifecycle.js";
|
2022-03-23 04:07:14 +08:00
|
|
|
+
|
|
|
|
+export class CodeServerClient extends Disposable {
|
|
|
|
+ constructor (
|
|
|
|
+ ) {
|
|
|
|
+ super();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ async startup(): Promise<void> {
|
|
|
|
+ // Emit ready events
|
|
|
|
+ const event = new CustomEvent('ide-ready');
|
|
|
|
+ window.dispatchEvent(event);
|
|
|
|
+
|
|
|
|
+ if (parent) {
|
|
|
|
+ // Tell the parent loading has completed.
|
|
|
|
+ parent.postMessage({ event: 'loaded' }, '*');
|
|
|
|
+
|
|
|
|
+ // Proxy or stop proxing events as requested by the parent.
|
|
|
|
+ const listeners = new Map<string, (event: Event) => void>();
|
|
|
|
+
|
|
|
|
+ window.addEventListener('message', parentEvent => {
|
|
|
|
+ const eventName = parentEvent.data.bind || parentEvent.data.unbind;
|
|
|
|
+ if (eventName) {
|
|
|
|
+ const oldListener = listeners.get(eventName);
|
|
|
|
+ if (oldListener) {
|
|
|
|
+ document.removeEventListener(eventName, oldListener);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (parentEvent.data.bind && parentEvent.data.prop) {
|
|
|
|
+ const listener = (event: Event) => {
|
|
|
|
+ parent?.postMessage(
|
|
|
|
+ {
|
|
|
|
+ event: parentEvent.data.event,
|
|
|
|
+ [parentEvent.data.prop]: event[parentEvent.data.prop as keyof Event],
|
|
|
|
+ },
|
|
|
|
+ window.location.origin,
|
|
|
|
+ );
|
|
|
|
+ };
|
|
|
|
+ listeners.set(parentEvent.data.bind, listener);
|
|
|
|
+ document.addEventListener(parentEvent.data.bind, listener);
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
Index: code-server/lib/vscode/src/vs/workbench/browser/web.main.ts
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/src/vs/workbench/browser/web.main.ts
|
|
|
|
+++ code-server/lib/vscode/src/vs/workbench/browser/web.main.ts
|
2024-10-18 12:31:28 +08:00
|
|
|
@@ -64,6 +64,7 @@ import { IOpenerService } from '../../pl
|
|
|
|
import { mixin, safeStringify } from '../../base/common/objects.js';
|
|
|
|
import { IndexedDB } from '../../base/browser/indexedDB.js';
|
|
|
|
import { WebFileSystemAccess } from '../../platform/files/browser/webFileSystemAccess.js';
|
|
|
|
+import { CodeServerClient } from '../../workbench/browser/client.js';
|
|
|
|
import { ITelemetryService } from '../../platform/telemetry/common/telemetry.js';
|
|
|
|
import { IProgressService } from '../../platform/progress/common/progress.js';
|
|
|
|
import { DelayedLogChannel } from '../services/output/common/delayedLogChannel.js';
|
2024-05-07 06:14:53 +08:00
|
|
|
@@ -131,6 +132,9 @@ export class BrowserMain extends Disposa
|
2022-03-23 04:07:14 +08:00
|
|
|
// Startup
|
|
|
|
const instantiationService = workbench.startup();
|
|
|
|
|
|
|
|
+ const codeServerClient = this._register(instantiationService.createInstance(CodeServerClient));
|
|
|
|
+ await codeServerClient.startup();
|
|
|
|
+
|
|
|
|
// Window
|
|
|
|
this._register(instantiationService.createInstance(BrowserWindow));
|
|
|
|
|
|
|
|
Index: code-server/lib/vscode/src/vs/base/common/product.ts
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/src/vs/base/common/product.ts
|
|
|
|
+++ code-server/lib/vscode/src/vs/base/common/product.ts
|
2023-04-11 02:28:13 +08:00
|
|
|
@@ -55,6 +55,8 @@ export type ExtensionVirtualWorkspaceSup
|
2022-03-23 04:07:14 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
export interface IProductConfiguration {
|
|
|
|
+ readonly codeServerVersion?: string
|
|
|
|
+
|
|
|
|
readonly version: string;
|
|
|
|
readonly date?: string;
|
|
|
|
readonly quality?: string;
|
|
|
|
Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench-dev.html
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/src/vs/code/browser/workbench/workbench-dev.html
|
|
|
|
+++ code-server/lib/vscode/src/vs/code/browser/workbench/workbench-dev.html
|
|
|
|
@@ -11,7 +11,8 @@
|
|
|
|
<meta name="mobile-web-app-capable" content="yes" />
|
|
|
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
|
|
<meta name="apple-mobile-web-app-title" content="Code">
|
2022-06-22 05:51:46 +08:00
|
|
|
- <link rel="apple-touch-icon" href="{{WORKBENCH_WEB_BASE_URL}}/resources/server/code-192.png" />
|
2022-03-23 04:07:14 +08:00
|
|
|
+ <link rel="apple-touch-icon" sizes="192x192" href="/_static/src/browser/media/pwa-icon-192.png" />
|
|
|
|
+ <link rel="apple-touch-icon" sizes="512x512" href="/_static/src/browser/media/pwa-icon-512.png" />
|
|
|
|
|
|
|
|
<!-- Disable pinch zooming -->
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
2024-11-02 04:32:25 +08:00
|
|
|
@@ -26,8 +27,9 @@
|
2022-03-23 04:07:14 +08:00
|
|
|
<meta id="vscode-workbench-builtin-extensions" data-settings="{{WORKBENCH_BUILTIN_EXTENSIONS}}">
|
|
|
|
|
|
|
|
<!-- Workbench Icon/Manifest/CSS -->
|
2022-06-22 05:51:46 +08:00
|
|
|
- <link rel="icon" href="{{WORKBENCH_WEB_BASE_URL}}/resources/server/favicon.ico" type="image/x-icon" />
|
|
|
|
- <link rel="manifest" href="{{WORKBENCH_WEB_BASE_URL}}/resources/server/manifest.json" crossorigin="use-credentials" />
|
2022-03-23 04:07:14 +08:00
|
|
|
+ <link rel="icon" href="/_static/src/browser/media/favicon-dark-support.svg" />
|
2022-06-22 05:51:46 +08:00
|
|
|
+ <link rel="alternate icon" href="/_static/src/browser/media/favicon.ico" type="image/x-icon" />
|
|
|
|
+ <link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
|
2024-11-02 04:32:25 +08:00
|
|
|
<style id="vscode-css-modules" type="text/css" media="screen"></style>
|
2022-03-23 04:07:14 +08:00
|
|
|
|
2024-11-02 04:32:25 +08:00
|
|
|
</head>
|
2022-03-23 04:07:14 +08:00
|
|
|
Index: code-server/lib/vscode/src/vs/code/browser/workbench/workbench.html
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/src/vs/code/browser/workbench/workbench.html
|
|
|
|
+++ code-server/lib/vscode/src/vs/code/browser/workbench/workbench.html
|
|
|
|
@@ -11,7 +11,8 @@
|
|
|
|
<meta name="mobile-web-app-capable" content="yes" />
|
|
|
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
|
|
|
<meta name="apple-mobile-web-app-title" content="Code">
|
2022-06-22 05:51:46 +08:00
|
|
|
- <link rel="apple-touch-icon" href="{{WORKBENCH_WEB_BASE_URL}}/resources/server/code-192.png" />
|
2022-03-23 04:07:14 +08:00
|
|
|
+ <link rel="apple-touch-icon" sizes="192x192" href="/_static/src/browser/media/pwa-icon-192.png" />
|
|
|
|
+ <link rel="apple-touch-icon" sizes="512x512" href="/_static/src/browser/media/pwa-icon-512.png" />
|
|
|
|
|
|
|
|
<!-- Disable pinch zooming -->
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
|
2022-06-22 05:51:46 +08:00
|
|
|
@@ -23,8 +24,9 @@
|
2022-03-23 04:07:14 +08:00
|
|
|
<meta id="vscode-workbench-auth-session" data-settings="{{WORKBENCH_AUTH_SESSION}}">
|
|
|
|
|
|
|
|
<!-- Workbench Icon/Manifest/CSS -->
|
2022-06-22 05:51:46 +08:00
|
|
|
- <link rel="icon" href="{{WORKBENCH_WEB_BASE_URL}}/resources/server/favicon.ico" type="image/x-icon" />
|
|
|
|
- <link rel="manifest" href="{{WORKBENCH_WEB_BASE_URL}}/resources/server/manifest.json" crossorigin="use-credentials" />
|
2022-03-23 04:07:14 +08:00
|
|
|
+ <link rel="icon" href="/_static/src/browser/media/favicon-dark-support.svg" />
|
2022-06-22 05:51:46 +08:00
|
|
|
+ <link rel="alternate icon" href="/_static/src/browser/media/favicon.ico" type="image/x-icon" />
|
|
|
|
+ <link rel="manifest" href="/manifest.json" crossorigin="use-credentials" />
|
2024-11-02 04:32:25 +08:00
|
|
|
<link rel="stylesheet" href="{{WORKBENCH_WEB_BASE_URL}}/out/vs/code/browser/workbench/workbench.css">
|
2022-03-23 04:07:14 +08:00
|
|
|
|
2022-06-22 05:51:46 +08:00
|
|
|
</head>
|
2022-04-01 05:14:03 +08:00
|
|
|
Index: code-server/lib/vscode/src/vs/server/node/webClientServer.ts
|
|
|
|
===================================================================
|
|
|
|
--- code-server.orig/lib/vscode/src/vs/server/node/webClientServer.ts
|
|
|
|
+++ code-server/lib/vscode/src/vs/server/node/webClientServer.ts
|
2024-11-02 04:32:25 +08:00
|
|
|
@@ -308,6 +308,7 @@ export class WebClientServer {
|
2023-05-16 07:44:03 +08:00
|
|
|
} : undefined;
|
|
|
|
|
2024-06-07 07:02:13 +08:00
|
|
|
const productConfiguration = {
|
2023-05-16 07:44:03 +08:00
|
|
|
+ codeServerVersion: this._productService.codeServerVersion,
|
|
|
|
embedderIdentifier: 'server-distro',
|
2024-06-07 07:02:13 +08:00
|
|
|
extensionsGallery: this._webExtensionResourceUrlTemplate && this._productService.extensionsGallery ? {
|
2023-05-16 07:44:03 +08:00
|
|
|
...this._productService.extensionsGallery,
|
2024-11-02 04:32:25 +08:00
|
|
|
Index: code-server/lib/vscode/src/server-main.ts
|
2024-08-16 13:33:21 +08:00
|
|
|
===================================================================
|
2024-11-02 04:32:25 +08:00
|
|
|
--- code-server.orig/lib/vscode/src/server-main.ts
|
|
|
|
+++ code-server/lib/vscode/src/server-main.ts
|
|
|
|
@@ -25,6 +25,9 @@ const __dirname = path.dirname(fileURLTo
|
|
|
|
perf.mark('code/server/start');
|
|
|
|
(globalThis as any).vscodeServerStartTime = performance.now();
|
|
|
|
|
|
|
|
+// This is not indented to make the diff less noisy. We need to move this out
|
|
|
|
+// of the top-level so it will not run immediately and we can control the start.
|
|
|
|
+async function start() {
|
|
|
|
// Do a quick parse to determine if a server or the cli needs to be started
|
|
|
|
const parsedArgs = minimist(process.argv.slice(2), {
|
|
|
|
boolean: ['start-server', 'list-extensions', 'print-ip-address', 'help', 'version', 'accept-server-license-terms', 'update-extensions'],
|
|
|
|
@@ -153,6 +156,7 @@ if (shouldSpawnCli) {
|
|
|
|
}
|
2024-08-16 13:33:21 +08:00
|
|
|
});
|
|
|
|
}
|
2024-11-02 04:32:25 +08:00
|
|
|
+}
|
2024-08-16 13:33:21 +08:00
|
|
|
|
2024-11-02 04:32:25 +08:00
|
|
|
function sanitizeStringArg(val: any): string | undefined {
|
|
|
|
if (Array.isArray(val)) { // if an argument is passed multiple times, minimist creates an array
|
2024-11-02 05:03:12 +08:00
|
|
|
@@ -283,3 +287,22 @@ function prompt(question: string): Promi
|
2024-11-02 04:32:25 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
+
|
2024-08-16 13:33:21 +08:00
|
|
|
+async function loadCodeWithNls() {
|
2024-11-02 04:32:25 +08:00
|
|
|
+ const nlsConfiguration = await resolveNLSConfiguration({
|
|
|
|
+ userLocale: 'en',
|
|
|
|
+ osLocale: 'en',
|
|
|
|
+ commit: product.commit,
|
|
|
|
+ userDataPath: '',
|
|
|
|
+ nlsMetadataPath: __dirname,
|
|
|
|
+ });
|
2024-08-16 13:33:21 +08:00
|
|
|
+ return loadCode(nlsConfiguration);
|
|
|
|
+}
|
|
|
|
+
|
2024-11-02 04:32:25 +08:00
|
|
|
+// This alias prevents the name getting mangled during minification which would
|
2024-10-18 12:31:28 +08:00
|
|
|
+// make it difficult to import.
|
|
|
|
+export { loadCodeWithNls as loadCodeWithNls };
|
|
|
|
+
|
|
|
|
+if (!process.env.CODE_SERVER_PARENT_PID) {
|
|
|
|
+ start();
|
|
|
|
+}
|