mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-27 01:25:36 -05:00
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:
@@ -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'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user