Initial VS Code 1.19 source merge (#571)

* Initial 1.19 xcopy

* Fix yarn build

* Fix numerous build breaks

* Next batch of build break fixes

* More build break fixes

* Runtime breaks

* Additional post merge fixes

* Fix windows setup file

* Fix test failures.

* Update license header blocks to refer to source eula
This commit is contained in:
Karl Burtram
2018-01-28 23:37:17 -08:00
committed by GitHub
parent 9a1ac20710
commit 251ae01c3e
8009 changed files with 93378 additions and 35634 deletions

View File

@@ -9,6 +9,8 @@ import * as assert from 'assert';
import { firstIndex } from 'vs/base/common/arrays';
import { localize } from 'vs/nls';
import { ParsedArgs } from '../common/environment';
import { isWindows } from 'vs/base/common/platform';
import product from 'vs/platform/node/product';
const options: minimist.Opts = {
string: [
@@ -51,7 +53,9 @@ const options: minimist.Opts = {
'sticky-quickopen',
'disable-telemetry',
'disable-updates',
'disable-crash-reporter'
'disable-crash-reporter',
'skip-add-to-recently-opened',
'status'
],
alias: {
add: 'a',
@@ -60,6 +64,7 @@ const options: minimist.Opts = {
wait: 'w',
diff: 'd',
goto: 'g',
status: 's',
'new-window': 'n',
'reuse-window': 'r',
performance: 'p',
@@ -131,18 +136,22 @@ export const optionsHelp: { [name: string]: string; } = {
'-n, --new-window': localize('newWindow', "Force a new instance of Code."),
'-p, --performance': localize('performance', "Start with the 'Developer: Startup Performance' command enabled."),
'--prof-startup': localize('prof-startup', "Run CPU profiler during startup"),
'--inspect-extensions': localize('inspect-extensions', "Allow debugging and profiling of extensions. Check the developer tools for the connection uri."),
'--inspect-brk-extensions': localize('inspect-brk-extensions', "Allow debugging and profiling of extensions with the extension host being paused after start. Check the developer tools for the connection uri."),
'-r, --reuse-window': localize('reuseWindow', "Force opening a file or folder in the last active window."),
'--user-data-dir <dir>': localize('userDataDir', "Specifies the directory that user data is kept in, useful when running as root."),
'--log <level>': localize('log', "Log level to use. Default is 'info'. Allowed values are 'critical', 'error', 'warn', 'info', 'debug', 'trace', 'off'."),
'--verbose': localize('verbose', "Print verbose output (implies --wait)."),
'-w, --wait': localize('wait', "Wait for the files to be closed before returning."),
'--extensions-dir <dir>': localize('extensionHomePath', "Set the root path for extensions."),
'--list-extensions': localize('listExtensions', "List the installed extensions."),
'--show-versions': localize('showVersions', "Show versions of installed extensions, when using --list-extension."),
'--install-extension (<extension-id> | <extension-vsix-path>)': localize('installExtension', "Installs an extension."),
'--uninstall-extension <extension-id>': localize('uninstallExtension', "Uninstalls an extension."),
'--uninstall-extension (<extension-id> | <extension-vsix-path>)': localize('uninstallExtension', "Uninstalls an extension."),
'--enable-proposed-api <extension-id>': localize('experimentalApis', "Enables proposed api features for an extension."),
'--disable-extensions': localize('disableExtensions', "Disable all installed extensions."),
'--disable-gpu': localize('disableGPU', "Disable GPU hardware acceleration."),
'-s, --status': localize('status', "Print process usage and diagnostics information."),
'-v, --version': localize('version', "Print version."),
'-h, --help': localize('help', "Print usage.")
};
@@ -189,6 +198,8 @@ export function buildHelpMessage(fullName: string, name: string, version: string
${ localize('usage', "Usage")}: ${executable} [${localize('options', "options")}] [${localize('paths', 'paths')}...]
${ isWindows ? localize('stdinWindows', "To read output from another program, append '-' (e.g. 'echo Hello World | {0} -')", product.applicationName) : localize('stdinUnix', "To read from stdin, append '-' (e.g. 'ps aux | grep code | {0} -')", product.applicationName)}
${ localize('optionsUpperCase', "Options")}:
${formatOptions(optionsHelp, columns)}`;
}

View File

@@ -8,12 +8,12 @@ import * as crypto from 'crypto';
import * as paths from 'vs/base/node/paths';
import * as os from 'os';
import * as path from 'path';
import * as fs from 'fs';
import URI from 'vs/base/common/uri';
import { generateUuid, isUUID } from 'vs/base/common/uuid';
import { memoize } from 'vs/base/common/decorators';
import pkg from 'vs/platform/node/package';
import product from 'vs/platform/node/product';
import { LogLevel } from 'vs/platform/log/common/log';
import { toLocalISOString } from 'vs/base/common/date';
// Read this before there's any chance it is overwritten
// Related to https://github.com/Microsoft/vscode/issues/30624
@@ -40,10 +40,6 @@ function getIPCHandle(userDataPath: string, type: string): string {
}
}
export function getInstallSourcePath(userDataPath: string): string {
return path.join(userDataPath, 'installSource');
}
export class EnvironmentService implements IEnvironmentService {
_serviceBrand: any;
@@ -55,6 +51,8 @@ export class EnvironmentService implements IEnvironmentService {
get execPath(): string { return this._execPath; }
readonly logsPath: string;
@memoize
get userHome(): string { return os.homedir(); }
@@ -71,6 +69,12 @@ export class EnvironmentService implements IEnvironmentService {
@memoize
get appSettingsPath(): string { return path.join(this.appSettingsHome, 'settings.json'); }
@memoize
get settingsSearchBuildId(): number { return product.settingsSearchBuildId; }
@memoize
get settingsSearchUrl(): string { return product.settingsSearchUrl; }
@memoize
get appKeybindingsPath(): string { return path.join(this.appSettingsHome, 'keybindings.json'); }
@@ -86,6 +90,9 @@ export class EnvironmentService implements IEnvironmentService {
@memoize
get workspacesHome(): string { return path.join(this.userDataPath, 'Workspaces'); }
@memoize
get installSourcePath(): string { return path.join(this.userDataPath, 'installSource'); }
@memoize
get extensionsPath(): string { return parsePathArg(this._args['extensions-dir'], process) || process.env['VSCODE_EXTENSIONS'] || path.join(this.userHome, product.dataFolderName, 'extensions'); }
@@ -99,6 +106,8 @@ export class EnvironmentService implements IEnvironmentService {
get skipGettingStarted(): boolean { return this._args['skip-getting-started']; }
get skipAddToRecentlyOpened(): boolean { return this._args['skip-add-to-recently-opened']; }
@memoize
get debugExtensionHost(): IExtensionHostDebugParams { return parseExtensionHostPort(this._args, this.isBuilt); }
@@ -107,22 +116,39 @@ export class EnvironmentService implements IEnvironmentService {
get isBuilt(): boolean { return !process.env['VSCODE_DEV']; }
get verbose(): boolean { return this._args.verbose; }
@memoize
get logLevel(): LogLevel {
if (this.verbose) {
return LogLevel.Trace;
}
if (typeof this._args.log === 'string') {
const logLevel = this._args.log.toLowerCase();
switch (logLevel) {
case 'trace':
return LogLevel.Trace;
case 'debug':
return LogLevel.Debug;
case 'info':
return LogLevel.Info;
case 'warn':
return LogLevel.Warning;
case 'error':
return LogLevel.Error;
case 'critical':
return LogLevel.Critical;
case 'off':
return LogLevel.Off;
}
}
return LogLevel.Info;
}
get wait(): boolean { return this._args.wait; }
get logExtensionHostCommunication(): boolean { return this._args.logExtensionHostCommunication; }
get performance(): boolean { return this._args.performance; }
@memoize
get profileStartup(): { prefix: string, dir: string } | undefined {
if (this._args['prof-startup']) {
return {
prefix: process.env.VSCODE_PROFILES_PREFIX,
dir: os.homedir()
};
} else {
return undefined;
}
}
get status(): boolean { return this._args.status; }
@memoize
get mainIPCHandle(): string { return getIPCHandle(this.userDataPath, 'main'); }
@@ -136,34 +162,13 @@ export class EnvironmentService implements IEnvironmentService {
get disableUpdates(): boolean { return !!this._args['disable-updates']; }
get disableCrashReporter(): boolean { return !!this._args['disable-crash-reporter']; }
readonly machineUUID: string;
readonly installSource: string;
constructor(private _args: ParsedArgs, private _execPath: string) {
const machineIdPath = path.join(this.userDataPath, 'machineid');
try {
this.machineUUID = fs.readFileSync(machineIdPath, 'utf8');
if (!isUUID(this.machineUUID)) {
throw new Error('Not a UUID');
}
} catch (err) {
this.machineUUID = generateUuid();
try {
fs.writeFileSync(machineIdPath, this.machineUUID, 'utf8');
} catch (err) {
// noop
}
if (!process.env['VSCODE_LOGS']) {
const key = toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, '');
process.env['VSCODE_LOGS'] = path.join(this.userDataPath, 'logs', key);
}
try {
this.installSource = fs.readFileSync(getInstallSourcePath(this.userDataPath), 'utf8').slice(0, 30);
} catch (err) {
this.installSource = '';
}
this.logsPath = process.env['VSCODE_LOGS'];
}
}