mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 10492ba146318412cbee8b76a8c630f226914734
This commit is contained in:
@@ -8,18 +8,19 @@ import { joinPath } from 'vs/base/common/resources';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
import { BACKUPS, IExtensionHostDebugParams } from 'vs/platform/environment/common/environment';
|
||||
import { IPath, IWindowConfiguration } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { IPath } from 'vs/platform/windows/common/windows';
|
||||
import { IWorkbenchEnvironmentService, IEnvironmentConfiguration } from 'vs/workbench/services/environment/common/environmentService';
|
||||
import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { memoize } from 'vs/base/common/decorators';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
|
||||
export class BrowserWindowConfiguration implements IWindowConfiguration {
|
||||
export class BrowserEnvironmentConfiguration implements IEnvironmentConfiguration {
|
||||
|
||||
constructor(
|
||||
private readonly options: IBrowserWorkbenchEnvironmentConstructionOptions,
|
||||
private readonly payload: Map<string, string> | undefined,
|
||||
private readonly environment: IWorkbenchEnvironmentService
|
||||
private readonly backupHome: URI
|
||||
) { }
|
||||
|
||||
@memoize
|
||||
@@ -29,10 +30,7 @@ export class BrowserWindowConfiguration implements IWindowConfiguration {
|
||||
get remoteAuthority(): string | undefined { return this.options.remoteAuthority; }
|
||||
|
||||
@memoize
|
||||
get connectionToken(): string | undefined { return this.options.connectionToken || this.getCookieValue('vscode-tkn'); }
|
||||
|
||||
@memoize
|
||||
get backupWorkspaceResource(): URI { return joinPath(this.environment.backupHome, this.options.workspaceId); }
|
||||
get backupWorkspaceResource(): URI { return joinPath(this.backupHome, this.options.workspaceId); }
|
||||
|
||||
@memoize
|
||||
get filesToOpenOrCreate(): IPath[] | undefined {
|
||||
@@ -46,15 +44,24 @@ export class BrowserWindowConfiguration implements IWindowConfiguration {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Currently unsupported in web but should look into support
|
||||
get filesToDiff(): IPath[] | undefined { return undefined; }
|
||||
highContrast = false;
|
||||
_ = [];
|
||||
@memoize
|
||||
get filesToDiff(): IPath[] | undefined {
|
||||
if (this.payload) {
|
||||
const fileToDiffDetail = this.payload.get('diffFileDetail');
|
||||
const fileToDiffMaster = this.payload.get('diffFileMaster');
|
||||
if (fileToDiffDetail && fileToDiffMaster) {
|
||||
return [
|
||||
{ fileUri: URI.parse(fileToDiffDetail) },
|
||||
{ fileUri: URI.parse(fileToDiffMaster) }
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
private getCookieValue(name: string): string | undefined {
|
||||
const m = document.cookie.match('(^|[^;]+)\\s*' + name + '\\s*=\\s*([^;]+)'); // See https://stackoverflow.com/a/25490531
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return m ? m.pop() : undefined;
|
||||
get highContrast() {
|
||||
return false; // could investigate to detect high contrast theme automatically
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,10 +82,10 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
|
||||
|
||||
_serviceBrand: undefined;
|
||||
|
||||
private _configuration: IWindowConfiguration | undefined = undefined;
|
||||
get configuration(): IWindowConfiguration {
|
||||
private _configuration: IEnvironmentConfiguration | undefined = undefined;
|
||||
get configuration(): IEnvironmentConfiguration {
|
||||
if (!this._configuration) {
|
||||
this._configuration = new BrowserWindowConfiguration(this.options, this.payload, this);
|
||||
this._configuration = new BrowserEnvironmentConfiguration(this.options, this.payload, this.backupHome);
|
||||
}
|
||||
|
||||
return this._configuration;
|
||||
@@ -90,6 +97,8 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
|
||||
@memoize
|
||||
get logsPath(): string { return this.options.logsPath.path; }
|
||||
|
||||
get logLevel(): string | undefined { return this.payload?.get('logLevel'); }
|
||||
|
||||
@memoize
|
||||
get logFile(): URI { return joinPath(this.options.logsPath, 'window.log'); }
|
||||
|
||||
@@ -111,6 +120,8 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
|
||||
@memoize
|
||||
get userDataSyncLogResource(): URI { return joinPath(this.options.logsPath, 'userDataSync.log'); }
|
||||
|
||||
get sync(): 'on' | 'off' { return 'on'; }
|
||||
|
||||
@memoize
|
||||
get keybindingsResource(): URI { return joinPath(this.userRoamingDataHome, 'keybindings.json'); }
|
||||
|
||||
@@ -123,6 +134,9 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
|
||||
@memoize
|
||||
get untitledWorkspacesHome(): URI { return joinPath(this.userRoamingDataHome, 'Workspaces'); }
|
||||
|
||||
@memoize
|
||||
get serviceMachineIdResource(): URI { return joinPath(this.userRoamingDataHome, 'machineid'); }
|
||||
|
||||
private _extensionHostDebugEnvironment: IExtensionHostDebugEnvironment | undefined = undefined;
|
||||
get debugExtensionHost(): IExtensionHostDebugParams {
|
||||
if (!this._extensionHostDebugEnvironment) {
|
||||
@@ -164,9 +178,11 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
|
||||
return this._extensionHostDebugEnvironment.extensionEnabledProposedApi;
|
||||
}
|
||||
|
||||
get disableExtensions() { return this.payload?.get('disableExtensions') === 'true'; }
|
||||
|
||||
@memoize
|
||||
get webviewExternalEndpoint(): string {
|
||||
// TODO: get fallback from product.json
|
||||
// TODO@matt: get fallback from product.json
|
||||
return (this.options.webviewEndpoint || 'https://{{uuid}}.vscode-webview-test.com/{{commit}}').replace('{{commit}}', product.commit || '0d728c31ebdf03869d2687d9be0b017667c9ff37');
|
||||
}
|
||||
|
||||
@@ -180,19 +196,20 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
|
||||
return this.webviewExternalEndpoint.replace('{{uuid}}', '*');
|
||||
}
|
||||
|
||||
// Currently unsupported in web but should look into support
|
||||
get disableExtensions() { return false; }
|
||||
get extensionsPath(): string | undefined { return undefined; }
|
||||
get verbose(): boolean { return false; }
|
||||
get disableUpdates(): boolean { return false; }
|
||||
get logExtensionHostCommunication(): boolean { return false; }
|
||||
galleryMachineIdResource?: URI;
|
||||
get disableTelemetry(): boolean { return false; }
|
||||
|
||||
get verbose(): boolean { return this.payload?.get('verbose') === 'true'; }
|
||||
get logExtensionHostCommunication(): boolean { return this.payload?.get('logExtensionHostCommunication') === 'true'; }
|
||||
|
||||
private payload: Map<string, string> | undefined;
|
||||
|
||||
constructor(readonly options: IBrowserWorkbenchEnvironmentConstructionOptions) {
|
||||
if (options.workspaceProvider && Array.isArray(options.workspaceProvider.payload)) {
|
||||
this.payload = new Map(options.workspaceProvider.payload);
|
||||
try {
|
||||
this.payload = new Map(options.workspaceProvider.payload);
|
||||
} catch (error) {
|
||||
onUnexpectedError(error); // possible invalid payload for map
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,35 +250,4 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
|
||||
|
||||
return extensionHostDebugEnvironment;
|
||||
}
|
||||
|
||||
//#region TODO MOVE TO NODE LAYER
|
||||
|
||||
args = { _: [] };
|
||||
|
||||
mainIPCHandle!: string;
|
||||
sharedIPCHandle!: string;
|
||||
|
||||
nodeCachedDataDir?: string;
|
||||
|
||||
driverHandle?: string;
|
||||
driverVerbose!: boolean;
|
||||
|
||||
installSourcePath!: string;
|
||||
|
||||
builtinExtensionsPath!: string;
|
||||
|
||||
globalStorageHome!: string;
|
||||
workspaceStorageHome!: string;
|
||||
|
||||
backupWorkspacesPath!: string;
|
||||
|
||||
machineSettingsResource!: URI;
|
||||
|
||||
userHome!: string;
|
||||
userDataPath!: string;
|
||||
appRoot!: string;
|
||||
appSettingsHome!: URI;
|
||||
execPath!: string;
|
||||
|
||||
//#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user