mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-06 01:25:38 -05:00
Merge from master
This commit is contained in:
@@ -8,12 +8,13 @@ import * as crypto from 'crypto';
|
||||
import * as paths from 'vs/base/node/paths';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import URI from 'vs/base/common/uri';
|
||||
import { memoize } from 'vs/base/common/decorators';
|
||||
import pkg from 'vs/platform/node/package';
|
||||
import product from 'vs/platform/node/product';
|
||||
import { toLocalISOString } from 'vs/base/common/date';
|
||||
import { isWindows, isLinux } from 'vs/base/common/platform';
|
||||
import { getPathFromAmdModule } from 'vs/base/common/amd';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
// Read this before there's any chance it is overwritten
|
||||
// Related to https://github.com/Microsoft/vscode/issues/30624
|
||||
@@ -77,7 +78,7 @@ export class EnvironmentService implements IEnvironmentService {
|
||||
get args(): ParsedArgs { return this._args; }
|
||||
|
||||
@memoize
|
||||
get appRoot(): string { return path.dirname(URI.parse(require.toUrl('')).fsPath); }
|
||||
get appRoot(): string { return path.dirname(getPathFromAmdModule(require, '')); }
|
||||
|
||||
get execPath(): string { return this._execPath; }
|
||||
|
||||
@@ -91,8 +92,9 @@ export class EnvironmentService implements IEnvironmentService {
|
||||
|
||||
@memoize
|
||||
get userDataPath(): string {
|
||||
if (process.env['VSCODE_PORTABLE']) {
|
||||
return path.join(process.env['VSCODE_PORTABLE'], 'user-data');
|
||||
const vscodePortable = process.env['VSCODE_PORTABLE'];
|
||||
if (vscodePortable) {
|
||||
return path.join(vscodePortable, 'user-data');
|
||||
}
|
||||
|
||||
return parseUserDataDir(this._args, process);
|
||||
@@ -100,7 +102,7 @@ export class EnvironmentService implements IEnvironmentService {
|
||||
|
||||
get appNameLong(): string { return product.nameLong; }
|
||||
|
||||
get appQuality(): string { return product.quality; }
|
||||
get appQuality(): string | undefined { return product.quality; }
|
||||
|
||||
@memoize
|
||||
get appSettingsHome(): string { return path.join(this.userDataPath, 'User'); }
|
||||
@@ -109,10 +111,16 @@ export class EnvironmentService implements IEnvironmentService {
|
||||
get appSettingsPath(): string { return path.join(this.appSettingsHome, 'settings.json'); }
|
||||
|
||||
@memoize
|
||||
get settingsSearchBuildId(): number { return product.settingsSearchBuildId; }
|
||||
get globalStorageHome(): string { return path.join(this.appSettingsHome, 'globalStorage'); }
|
||||
|
||||
@memoize
|
||||
get settingsSearchUrl(): string { return product.settingsSearchUrl; }
|
||||
get workspaceStorageHome(): string { return path.join(this.appSettingsHome, 'workspaceStorage'); }
|
||||
|
||||
@memoize
|
||||
get settingsSearchBuildId(): number | undefined { return product.settingsSearchBuildId; }
|
||||
|
||||
@memoize
|
||||
get settingsSearchUrl(): string | undefined { return product.settingsSearchUrl; }
|
||||
|
||||
@memoize
|
||||
get appKeybindingsPath(): string { return path.join(this.appSettingsHome, 'keybindings.json'); }
|
||||
@@ -132,32 +140,57 @@ export class EnvironmentService implements IEnvironmentService {
|
||||
@memoize
|
||||
get installSourcePath(): string { return path.join(this.userDataPath, 'installSource'); }
|
||||
|
||||
@memoize
|
||||
get builtinExtensionsPath(): string {
|
||||
const fromArgs = parsePathArg(this._args['builtin-extensions-dir'], process);
|
||||
if (fromArgs) {
|
||||
return fromArgs;
|
||||
} else {
|
||||
return path.normalize(path.join(getPathFromAmdModule(require, ''), '..', 'extensions'));
|
||||
}
|
||||
}
|
||||
|
||||
@memoize
|
||||
get extensionsPath(): string {
|
||||
const fromArgs = parsePathArg(this._args['extensions-dir'], process);
|
||||
|
||||
if (fromArgs) {
|
||||
return fromArgs;
|
||||
} else if (process.env['VSCODE_EXTENSIONS']) {
|
||||
return process.env['VSCODE_EXTENSIONS'];
|
||||
} else if (process.env['VSCODE_PORTABLE']) {
|
||||
return path.join(process.env['VSCODE_PORTABLE'], 'extensions');
|
||||
} else {
|
||||
return path.join(this.userHome, product.dataFolderName, 'extensions');
|
||||
}
|
||||
|
||||
const vscodeExtensions = process.env['VSCODE_EXTENSIONS'];
|
||||
if (vscodeExtensions) {
|
||||
return vscodeExtensions;
|
||||
}
|
||||
|
||||
const vscodePortable = process.env['VSCODE_PORTABLE'];
|
||||
if (vscodePortable) {
|
||||
return path.join(vscodePortable, 'extensions');
|
||||
}
|
||||
|
||||
return path.join(this.userHome, product.dataFolderName, 'extensions');
|
||||
}
|
||||
|
||||
@memoize
|
||||
get extensionDevelopmentPath(): string { return this._args.extensionDevelopmentPath ? path.normalize(this._args.extensionDevelopmentPath) : this._args.extensionDevelopmentPath; }
|
||||
get extensionDevelopmentLocationURI(): URI | undefined {
|
||||
const s = this._args.extensionDevelopmentPath;
|
||||
if (s) {
|
||||
if (/^[^:/?#]+?:\/\//.test(s)) {
|
||||
return URI.parse(s);
|
||||
}
|
||||
return URI.file(path.normalize(s));
|
||||
}
|
||||
return void 0;
|
||||
}
|
||||
|
||||
@memoize
|
||||
get extensionTestsPath(): string { return this._args.extensionTestsPath ? path.normalize(this._args.extensionTestsPath) : this._args.extensionTestsPath; }
|
||||
get extensionTestsPath(): string | undefined { return this._args.extensionTestsPath ? path.normalize(this._args.extensionTestsPath) : this._args.extensionTestsPath; }
|
||||
|
||||
get disableExtensions(): boolean | string[] {
|
||||
if (this._args['disable-extensions']) {
|
||||
return true;
|
||||
}
|
||||
const disableExtensions: string | string[] = this._args['disable-extension'];
|
||||
const disableExtensions = this._args['disable-extension'];
|
||||
if (disableExtensions) {
|
||||
if (typeof disableExtensions === 'string') {
|
||||
return [disableExtensions];
|
||||
@@ -169,11 +202,11 @@ export class EnvironmentService implements IEnvironmentService {
|
||||
return false;
|
||||
}
|
||||
|
||||
get skipGettingStarted(): boolean { return this._args['skip-getting-started']; }
|
||||
get skipGettingStarted(): boolean { return !!this._args['skip-getting-started']; }
|
||||
|
||||
get skipReleaseNotes(): boolean { return this._args['skip-release-notes']; }
|
||||
get skipReleaseNotes(): boolean { return !!this._args['skip-release-notes']; }
|
||||
|
||||
get skipAddToRecentlyOpened(): boolean { return this._args['skip-add-to-recently-opened']; }
|
||||
get skipAddToRecentlyOpened(): boolean { return !!this._args['skip-add-to-recently-opened']; }
|
||||
|
||||
@memoize
|
||||
get debugExtensionHost(): IExtensionHostDebugParams { return parseExtensionHostPort(this._args, this.isBuilt); }
|
||||
@@ -182,14 +215,15 @@ export class EnvironmentService implements IEnvironmentService {
|
||||
get debugSearch(): IDebugParams { return parseSearchPort(this._args, this.isBuilt); }
|
||||
|
||||
get isBuilt(): boolean { return !process.env['VSCODE_DEV']; }
|
||||
get verbose(): boolean { return this._args.verbose; }
|
||||
get log(): string { return this._args.log; }
|
||||
get verbose(): boolean { return !!this._args.verbose; }
|
||||
get log(): string | undefined { return this._args.log; }
|
||||
|
||||
get wait(): boolean { return this._args.wait; }
|
||||
get logExtensionHostCommunication(): boolean { return this._args.logExtensionHostCommunication; }
|
||||
get wait(): boolean { return !!this._args.wait; }
|
||||
|
||||
get performance(): boolean { return this._args.performance; }
|
||||
get status(): boolean { return this._args.status; }
|
||||
get logExtensionHostCommunication(): boolean { return !!this._args.logExtensionHostCommunication; }
|
||||
|
||||
get performance(): boolean { return !!this._args.performance; }
|
||||
get status(): boolean { return !!this._args.status; }
|
||||
|
||||
@memoize
|
||||
get mainIPCHandle(): string { return getIPCHandle(this.userDataPath, 'main'); }
|
||||
@@ -198,13 +232,13 @@ export class EnvironmentService implements IEnvironmentService {
|
||||
get sharedIPCHandle(): string { return getIPCHandle(this.userDataPath, 'shared'); }
|
||||
|
||||
@memoize
|
||||
get nodeCachedDataDir(): string { return this.isBuilt ? path.join(this.userDataPath, 'CachedData', product.commit || new Array(41).join('0')) : undefined; }
|
||||
get nodeCachedDataDir(): string | undefined { return process.env['VSCODE_NODE_CACHED_DATA_DIR'] || undefined; }
|
||||
|
||||
get disableUpdates(): boolean { return !!this._args['disable-updates']; }
|
||||
get disableCrashReporter(): boolean { return !!this._args['disable-crash-reporter']; }
|
||||
|
||||
get driverHandle(): string { return this._args['driver']; }
|
||||
get driverVerbose(): boolean { return this._args['driver-verbose']; }
|
||||
get driverHandle(): string | undefined { return this._args['driver']; }
|
||||
get driverVerbose(): boolean { return !!this._args['driver-verbose']; }
|
||||
|
||||
constructor(private _args: ParsedArgs, private _execPath: string) {
|
||||
if (!process.env['VSCODE_LOGS']) {
|
||||
@@ -212,7 +246,7 @@ export class EnvironmentService implements IEnvironmentService {
|
||||
process.env['VSCODE_LOGS'] = path.join(this.userDataPath, 'logs', key);
|
||||
}
|
||||
|
||||
this.logsPath = process.env['VSCODE_LOGS'];
|
||||
this.logsPath = process.env['VSCODE_LOGS']!;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -224,14 +258,14 @@ export function parseSearchPort(args: ParsedArgs, isBuild: boolean): IDebugParam
|
||||
return parseDebugPort(args.debugSearch, args.debugBrkSearch, 5876, isBuild);
|
||||
}
|
||||
|
||||
export function parseDebugPort(debugArg: string, debugBrkArg: string, defaultBuildPort: number, isBuild: boolean, debugId?: string): IExtensionHostDebugParams {
|
||||
export function parseDebugPort(debugArg: string | undefined, debugBrkArg: string | undefined, defaultBuildPort: number, isBuild: boolean, debugId?: string): IExtensionHostDebugParams {
|
||||
const portStr = debugBrkArg || debugArg;
|
||||
const port = Number(portStr) || (!isBuild ? defaultBuildPort : null);
|
||||
const brk = port ? Boolean(!!debugBrkArg) : false;
|
||||
return { port, break: brk, debugId };
|
||||
}
|
||||
|
||||
function parsePathArg(arg: string, process: NodeJS.Process): string {
|
||||
function parsePathArg(arg: string | undefined, process: NodeJS.Process): string | undefined {
|
||||
if (!arg) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user