mirror of
https://github.com/coder/code-server.git
synced 2026-05-06 20:41:59 +02:00
Update to VS Code 1.52.1
This commit is contained in:
@@ -74,12 +74,13 @@ export interface NativeParsedArgs {
|
||||
'driver'?: string;
|
||||
'driver-verbose'?: boolean;
|
||||
'remote'?: string;
|
||||
'disable-user-env-probe'?: boolean;
|
||||
'force'?: boolean;
|
||||
'do-not-sync'?: boolean;
|
||||
'force-user-env'?: boolean;
|
||||
'force-disable-user-env'?: boolean;
|
||||
'sync'?: 'on' | 'off';
|
||||
'__sandbox'?: boolean;
|
||||
'logsPath'?: string;
|
||||
|
||||
// chromium command line args: https://electronjs.org/docs/all#supported-chrome-command-line-switches
|
||||
'no-proxy-server'?: boolean;
|
||||
|
||||
@@ -119,7 +119,7 @@ export interface INativeEnvironmentService extends IEnvironmentService {
|
||||
sharedIPCHandle: string;
|
||||
|
||||
// --- Extensions
|
||||
extensionsPath?: string;
|
||||
extensionsPath: string;
|
||||
extensionsDownloadPath: string;
|
||||
builtinExtensionsPath: string;
|
||||
extraExtensionPaths: string[]
|
||||
|
||||
@@ -19,6 +19,9 @@ export const IEnvironmentMainService = createDecorator<IEnvironmentMainService>(
|
||||
*/
|
||||
export interface IEnvironmentMainService extends INativeEnvironmentService {
|
||||
|
||||
// --- NLS cache path
|
||||
cachedLanguagesPath: string;
|
||||
|
||||
// --- backup paths
|
||||
backupHome: string;
|
||||
backupWorkspacesPath: string;
|
||||
@@ -35,7 +38,10 @@ export interface IEnvironmentMainService extends INativeEnvironmentService {
|
||||
disableUpdates: boolean;
|
||||
}
|
||||
|
||||
export class EnvironmentMainService extends NativeEnvironmentService {
|
||||
export class EnvironmentMainService extends NativeEnvironmentService implements IEnvironmentMainService {
|
||||
|
||||
@memoize
|
||||
get cachedLanguagesPath(): string { return join(this.userDataPath, 'clp'); }
|
||||
|
||||
@memoize
|
||||
get backupHome(): string { return join(this.userDataPath, 'Backups'); }
|
||||
|
||||
@@ -43,8 +43,6 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
|
||||
'goto': { type: 'boolean', cat: 'o', alias: 'g', args: 'file:line[:character]', description: localize('goto', "Open a file at the path on the specified line and character position.") },
|
||||
'new-window': { type: 'boolean', cat: 'o', alias: 'n', description: localize('newWindow', "Force to open a new window.") },
|
||||
'reuse-window': { type: 'boolean', cat: 'o', alias: 'r', description: localize('reuseWindow', "Force to open a file or folder in an already opened window.") },
|
||||
'folder-uri': { type: 'string[]', cat: 'o', args: 'uri', description: localize('folderUri', "Opens a window with given folder uri(s)") },
|
||||
'file-uri': { type: 'string[]', cat: 'o', args: 'uri', description: localize('fileUri', "Opens a window with given file uri(s)") },
|
||||
'wait': { type: 'boolean', cat: 'o', alias: 'w', description: localize('wait', "Wait for the files to be closed before returning.") },
|
||||
'waitMarkerFilePath': { type: 'string' },
|
||||
'locale': { type: 'string', cat: 'o', args: 'locale', description: localize('locale', "The locale to use (e.g. en-US or zh-TW).") },
|
||||
@@ -59,7 +57,7 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
|
||||
'list-extensions': { type: 'boolean', cat: 'e', description: localize('listExtensions', "List the installed extensions.") },
|
||||
'show-versions': { type: 'boolean', cat: 'e', description: localize('showVersions', "Show versions of installed extensions, when using --list-extension.") },
|
||||
'category': { type: 'string', cat: 'e', description: localize('category', "Filters installed extensions by provided category, when using --list-extension.") },
|
||||
'install-extension': { type: 'string[]', cat: 'e', args: 'extension-id[@version] | path-to-vsix', description: localize('installExtension', "Installs or updates the extension. Use `--force` argument to avoid prompts. The identifier of an extension is always `${publisher}.${name}`. To install a specific version provide `@${version}`. For example: 'vscode.csharp@1.2.3'.") },
|
||||
'install-extension': { type: 'string[]', cat: 'e', args: 'extension-id[@version] | path-to-vsix', description: localize('installExtension', "Installs or updates the extension. The identifier of an extension is always `${publisher}.${name}`. Use `--force` argument to update to latest version. To install a specific version provide `@${version}`. For example: 'vscode.csharp@1.2.3'.") },
|
||||
'uninstall-extension': { type: 'string[]', cat: 'e', args: 'extension-id', description: localize('uninstallExtension', "Uninstalls an extension.") },
|
||||
'enable-proposed-api': { type: 'string[]', cat: 'e', args: 'extension-id', description: localize('experimentalApis', "Enables proposed API features for extensions. Can receive one or more extension IDs to enable individually.") },
|
||||
|
||||
@@ -81,6 +79,9 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
|
||||
'telemetry': { type: 'boolean', cat: 't', description: localize('telemetry', "Shows all telemetry events which VS code collects.") },
|
||||
|
||||
'remote': { type: 'string' },
|
||||
'folder-uri': { type: 'string[]', cat: 'o', args: 'uri' },
|
||||
'file-uri': { type: 'string[]', cat: 'o', args: 'uri' },
|
||||
|
||||
'locate-extension': { type: 'string[]' },
|
||||
'extensionDevelopmentPath': { type: 'string[]' },
|
||||
'extensionTestsPath': { type: 'string' },
|
||||
@@ -98,7 +99,6 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
|
||||
'disable-crash-reporter': { type: 'boolean' },
|
||||
'crash-reporter-directory': { type: 'string' },
|
||||
'crash-reporter-id': { type: 'string' },
|
||||
'disable-user-env-probe': { type: 'boolean' },
|
||||
'skip-add-to-recently-opened': { type: 'boolean' },
|
||||
'unity-launch': { type: 'boolean' },
|
||||
'open-url': { type: 'boolean' },
|
||||
@@ -112,8 +112,10 @@ export const OPTIONS: OptionDescriptions<Required<NativeParsedArgs>> = {
|
||||
'trace-category-filter': { type: 'string' },
|
||||
'trace-options': { type: 'string' },
|
||||
'force-user-env': { type: 'boolean' },
|
||||
'force-disable-user-env': { type: 'boolean' },
|
||||
'open-devtools': { type: 'boolean' },
|
||||
'__sandbox': { type: 'boolean' },
|
||||
'logsPath': { type: 'string' },
|
||||
|
||||
// chromium flags
|
||||
'no-proxy-server': { type: 'boolean' },
|
||||
|
||||
@@ -52,7 +52,7 @@ export function parseMainProcessArgv(processArgv: string[]): NativeParsedArgs {
|
||||
}
|
||||
|
||||
// If called from CLI, don't report warnings as they are already reported.
|
||||
let reportWarnings = !process.env['VSCODE_CLI'];
|
||||
const reportWarnings = !isLaunchedFromCli(process.env);
|
||||
return parseAndValidate(args, reportWarnings);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ export function parseMainProcessArgv(processArgv: string[]): NativeParsedArgs {
|
||||
* Use this to parse raw code CLI process.argv such as: `Electron cli.js . --verbose --wait`
|
||||
*/
|
||||
export function parseCLIProcessArgv(processArgv: string[]): NativeParsedArgs {
|
||||
let [, , ...args] = processArgv; // remove the first non-option argument: it's always the app location
|
||||
const [, , ...args] = processArgv; // remove the first non-option argument: it's always the app location
|
||||
|
||||
return parseAndValidate(args, true);
|
||||
}
|
||||
@@ -78,3 +78,7 @@ export function addArg(argv: string[], ...args: string[]): string[] {
|
||||
|
||||
return argv;
|
||||
}
|
||||
|
||||
export function isLaunchedFromCli(env: NodeJS.ProcessEnv): boolean {
|
||||
return env['VSCODE_CLI'] === '1';
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as os from 'os';
|
||||
import { IDebugParams, IExtensionHostDebugParams, INativeEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||
import * as paths from 'vs/base/node/paths';
|
||||
import * as os from 'os';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
import { memoize } from 'vs/base/common/decorators';
|
||||
@@ -211,12 +211,11 @@ export class NativeEnvironmentService implements INativeEnvironmentService {
|
||||
get disableTelemetry(): boolean { return !!this._args['disable-telemetry']; }
|
||||
|
||||
constructor(protected _args: NativeParsedArgs) {
|
||||
if (!process.env['VSCODE_LOGS']) {
|
||||
if (!_args.logsPath) {
|
||||
const key = toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, '');
|
||||
process.env['VSCODE_LOGS'] = path.join(this.userDataPath, 'logs', key);
|
||||
_args.logsPath = path.join(this.userDataPath, 'logs', key);
|
||||
}
|
||||
|
||||
this.logsPath = process.env['VSCODE_LOGS']!;
|
||||
this.logsPath = _args.logsPath;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -253,5 +252,5 @@ export function parsePathArg(arg: string | undefined, process: NodeJS.Process):
|
||||
}
|
||||
|
||||
export function parseUserDataDir(args: NativeParsedArgs, process: NodeJS.Process): string {
|
||||
return parsePathArg(args['user-data-dir'], process) || path.resolve(paths.getDefaultUserDataPath(process.platform));
|
||||
return parsePathArg(args['user-data-dir'], process) || path.resolve(paths.getDefaultUserDataPath());
|
||||
}
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { formatOptions, Option } from 'vs/platform/environment/node/argv';
|
||||
import { addArg } from 'vs/platform/environment/node/argvHelper';
|
||||
|
||||
suite('formatOptions', () => {
|
||||
|
||||
function o(description: string): Option<any> {
|
||||
return {
|
||||
description, type: 'string'
|
||||
};
|
||||
}
|
||||
|
||||
test('Text should display small columns correctly', () => {
|
||||
assert.deepEqual(
|
||||
formatOptions({
|
||||
'add': o('bar')
|
||||
}, 80),
|
||||
[' --add bar']
|
||||
);
|
||||
assert.deepEqual(
|
||||
formatOptions({
|
||||
'add': o('bar'),
|
||||
'wait': o('ba'),
|
||||
'trace': o('b')
|
||||
}, 80),
|
||||
[
|
||||
' --add bar',
|
||||
' --wait ba',
|
||||
' --trace b'
|
||||
]);
|
||||
});
|
||||
|
||||
test('Text should wrap', () => {
|
||||
assert.deepEqual(
|
||||
formatOptions({
|
||||
'add': o((<any>'bar ').repeat(9))
|
||||
}, 40),
|
||||
[
|
||||
' --add bar bar bar bar bar bar bar bar',
|
||||
' bar'
|
||||
]);
|
||||
});
|
||||
|
||||
test('Text should revert to the condensed view when the terminal is too narrow', () => {
|
||||
assert.deepEqual(
|
||||
formatOptions({
|
||||
'add': o((<any>'bar ').repeat(9))
|
||||
}, 30),
|
||||
[
|
||||
' --add',
|
||||
' bar bar bar bar bar bar bar bar bar '
|
||||
]);
|
||||
});
|
||||
|
||||
test('addArg', () => {
|
||||
assert.deepEqual(addArg([], 'foo'), ['foo']);
|
||||
assert.deepEqual(addArg([], 'foo', 'bar'), ['foo', 'bar']);
|
||||
assert.deepEqual(addArg(['foo'], 'bar'), ['foo', 'bar']);
|
||||
assert.deepEqual(addArg(['--wait'], 'bar'), ['--wait', 'bar']);
|
||||
assert.deepEqual(addArg(['--wait', '--', '--foo'], 'bar'), ['--wait', 'bar', '--', '--foo']);
|
||||
assert.deepEqual(addArg(['--', '--foo'], 'bar'), ['bar', '--', '--foo']);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,105 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as assert from 'assert';
|
||||
import { isMacintosh, isWindows } from 'vs/base/common/platform';
|
||||
|
||||
function testErrorMessage(module: string): string {
|
||||
return `Unable to load "${module}" dependency. It was probably not compiled for the right operating system architecture or had missing build tools.`;
|
||||
}
|
||||
|
||||
suite('Native Modules (all platforms)', () => {
|
||||
|
||||
test('native-is-elevated', async () => {
|
||||
const isElevated = await import('native-is-elevated');
|
||||
assert.ok(typeof isElevated === 'function', testErrorMessage('native-is-elevated '));
|
||||
});
|
||||
|
||||
test('native-keymap', async () => {
|
||||
const keyMap = await import('native-keymap');
|
||||
assert.ok(typeof keyMap.getCurrentKeyboardLayout === 'function', testErrorMessage('native-keymap'));
|
||||
});
|
||||
|
||||
test('native-watchdog', async () => {
|
||||
const watchDog = await import('native-watchdog');
|
||||
assert.ok(typeof watchDog.start === 'function', testErrorMessage('native-watchdog'));
|
||||
});
|
||||
|
||||
test('node-pty', async () => {
|
||||
const nodePty = await import('node-pty');
|
||||
assert.ok(typeof nodePty.spawn === 'function', testErrorMessage('node-pty'));
|
||||
});
|
||||
|
||||
test('spdlog', async () => {
|
||||
const spdlog = await import('spdlog');
|
||||
assert.ok(typeof spdlog.createRotatingLogger === 'function', testErrorMessage('spdlog'));
|
||||
});
|
||||
|
||||
test('v8-inspect-profiler', async () => {
|
||||
const profiler = await import('v8-inspect-profiler');
|
||||
assert.ok(typeof profiler.startProfiling === 'function', testErrorMessage('v8-inspect-profiler'));
|
||||
});
|
||||
|
||||
test('vscode-nsfw', async () => {
|
||||
const nsfWatcher = await import('vscode-nsfw');
|
||||
assert.ok(typeof nsfWatcher === 'function', testErrorMessage('vscode-nsfw'));
|
||||
});
|
||||
|
||||
test('vscode-sqlite3', async () => {
|
||||
const sqlite3 = await import('vscode-sqlite3');
|
||||
assert.ok(typeof sqlite3.Database === 'function', testErrorMessage('vscode-sqlite3'));
|
||||
});
|
||||
});
|
||||
|
||||
(!isMacintosh ? suite.skip : suite)('Native Modules (macOS)', () => {
|
||||
|
||||
test('chokidar (fsevents)', async () => {
|
||||
const chokidar = await import('chokidar');
|
||||
const watcher = chokidar.watch(__dirname);
|
||||
assert.ok(watcher.options.useFsEvents, testErrorMessage('chokidar (fsevents)'));
|
||||
|
||||
return watcher.close();
|
||||
});
|
||||
});
|
||||
|
||||
(!isWindows ? suite.skip : suite)('Native Modules (Windows)', () => {
|
||||
|
||||
test('windows-mutex', async () => {
|
||||
const mutex = await import('windows-mutex');
|
||||
assert.ok(mutex && typeof mutex.isActive === 'function', testErrorMessage('windows-mutex'));
|
||||
assert.ok(typeof mutex.isActive === 'function', testErrorMessage('windows-mutex'));
|
||||
});
|
||||
|
||||
test('windows-foreground-love', async () => {
|
||||
const foregroundLove = await import('windows-foreground-love');
|
||||
assert.ok(typeof foregroundLove.allowSetForegroundWindow === 'function', testErrorMessage('windows-foreground-love'));
|
||||
});
|
||||
|
||||
test('windows-process-tree', async () => {
|
||||
const processTree = await import('windows-process-tree');
|
||||
assert.ok(typeof processTree.getProcessTree === 'function', testErrorMessage('windows-process-tree'));
|
||||
});
|
||||
|
||||
test('vscode-windows-registry', async () => {
|
||||
const windowsRegistry = await import('vscode-windows-registry');
|
||||
assert.ok(typeof windowsRegistry.GetStringRegKey === 'function', testErrorMessage('vscode-windows-registry'));
|
||||
});
|
||||
|
||||
test('vscode-windows-ca-certs', async () => {
|
||||
// @ts-ignore Windows only
|
||||
const windowsCerts = await import('vscode-windows-ca-certs');
|
||||
const store = windowsCerts();
|
||||
assert.ok(windowsCerts, testErrorMessage('vscode-windows-ca-certs'));
|
||||
let certCount = 0;
|
||||
try {
|
||||
while (store.next()) {
|
||||
certCount++;
|
||||
}
|
||||
} finally {
|
||||
store.done();
|
||||
}
|
||||
assert(certCount > 0);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user