提交 b4679a37 编写于 作者: B Benjamin Pasero

debt - move some environment to workbench

上级 f3d97621
......@@ -140,24 +140,15 @@ export interface IEnvironmentService {
extensionTestsLocationURI?: URI;
debugExtensionHost: IExtensionHostDebugParams;
debugSearch: IDebugParams;
logExtensionHostCommunication: boolean;
isBuilt: boolean;
wait: boolean;
status: boolean;
// logging
log?: string;
logsPath: string;
verbose: boolean;
skipGettingStarted: boolean | undefined;
skipReleaseNotes: boolean | undefined;
skipAddToRecentlyOpened: boolean;
mainIPCHandle: string;
sharedIPCHandle: string;
......@@ -170,9 +161,5 @@ export interface IEnvironmentService {
driverHandle?: string;
driverVerbose: boolean;
webviewEndpoint?: string;
readonly webviewResourceRoot: string;
readonly webviewCspSource: string;
readonly galleryMachineIdResource?: URI;
galleryMachineIdResource?: URI;
}
......@@ -236,26 +236,15 @@ export class EnvironmentService implements IEnvironmentService {
return false;
}
get skipGettingStarted(): boolean { return !!this._args['skip-getting-started']; }
get skipReleaseNotes(): boolean { return !!this._args['skip-release-notes']; }
get skipAddToRecentlyOpened(): boolean { return !!this._args['skip-add-to-recently-opened']; }
@memoize
get debugExtensionHost(): IExtensionHostDebugParams { return parseExtensionHostPort(this._args, this.isBuilt); }
@memoize
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 | undefined { return this._args.log; }
get wait(): boolean { return !!this._args.wait; }
get logExtensionHostCommunication(): boolean { return !!this._args.logExtensionHostCommunication; }
get status(): boolean { return !!this._args.status; }
@memoize
......@@ -276,9 +265,6 @@ export class EnvironmentService implements IEnvironmentService {
get driverHandle(): string | undefined { return this._args['driver']; }
get driverVerbose(): boolean { return !!this._args['driver-verbose']; }
readonly webviewResourceRoot = 'vscode-resource:{{resource}}';
readonly webviewCspSource = 'vscode-resource:';
constructor(private _args: ParsedArgs, private _execPath: string) {
if (!process.env['VSCODE_LOGS']) {
const key = toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, '');
......
......@@ -119,7 +119,7 @@ export class ProductContribution implements IWorkbenchContribution {
@IStorageService storageService: IStorageService,
@IInstantiationService instantiationService: IInstantiationService,
@INotificationService notificationService: INotificationService,
@IEnvironmentService environmentService: IEnvironmentService,
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
@IOpenerService openerService: IOpenerService,
@IConfigurationService configurationService: IConfigurationService,
@IWindowService windowService: IWindowService,
......
......@@ -7,7 +7,7 @@ import { Emitter } from 'vs/base/common/event';
import { URI } from 'vs/base/common/uri';
import { Webview, WebviewContentOptions, WebviewOptions } from 'vs/workbench/contrib/webview/browser/webview';
import { IThemeService, ITheme } from 'vs/platform/theme/common/themeService';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IFileService } from 'vs/platform/files/common/files';
import { Disposable } from 'vs/base/common/lifecycle';
import { areWebviewInputOptionsEqual } from 'vs/workbench/contrib/webview/browser/webviewEditorService';
......@@ -40,14 +40,14 @@ export class IFrameWebview extends Disposable implements Webview {
contentOptions: WebviewContentOptions,
@IThemeService themeService: IThemeService,
@ITunnelService tunnelService: ITunnelService,
@IEnvironmentService private readonly environmentService: IEnvironmentService,
@IWorkbenchEnvironmentService private readonly environmentService: IWorkbenchEnvironmentService,
@IFileService private readonly fileService: IFileService,
@IConfigurationService private readonly _configurationService: IConfigurationService,
) {
super();
const useExternalEndpoint = this._configurationService.getValue<string>('webview.experimental.useExternalEndpoint');
if (typeof environmentService.webviewEndpoint !== 'string' && !useExternalEndpoint) {
if (!useExternalEndpoint && (!environmentService.options || typeof environmentService.options.webviewEndpoint !== 'string')) {
throw new Error('To use iframe based webviews, you must configure `environmentService.webviewEndpoint`');
}
......@@ -145,7 +145,7 @@ export class IFrameWebview extends Disposable implements Webview {
private get endpoint(): string {
const useExternalEndpoint = this._configurationService.getValue<string>('webview.experimental.useExternalEndpoint');
const baseEndpoint = useExternalEndpoint ? 'https://{{uuid}}.vscode-webview-test.com/8fa811108f0f0524c473020ef57b6620f6c201e1' : this.environmentService.webviewEndpoint!;
const baseEndpoint = useExternalEndpoint ? 'https://{{uuid}}.vscode-webview-test.com/8fa811108f0f0524c473020ef57b6620f6c201e1' : this.environmentService.options!.webviewEndpoint!;
const endpoint = baseEndpoint.replace('{{uuid}}', this.id);
if (endpoint[endpoint.length - 1] === '/') {
return endpoint.slice(0, endpoint.length - 1);
......
......@@ -6,7 +6,7 @@
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { ITelemetryService, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import * as platform from 'vs/base/common/platform';
import product from 'vs/platform/product/node/product';
import { IOpenerService } from 'vs/platform/opener/common/opener';
......@@ -21,7 +21,7 @@ export class GettingStarted implements IWorkbenchContribution {
constructor(
@IStorageService private readonly storageService: IStorageService,
@IEnvironmentService environmentService: IEnvironmentService,
@IWorkbenchEnvironmentService environmentService: IWorkbenchEnvironmentService,
@ITelemetryService private readonly telemetryService: ITelemetryService,
@IOpenerService private readonly openerService: IOpenerService
) {
......
......@@ -96,11 +96,9 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
break: false
};
this.webviewEndpoint = options.webviewEndpoint;
this.untitledWorkspacesHome = URI.from({ scheme: Schemas.untitled, path: 'Workspaces' });
if (document && document.location && document.location.search) {
const map = new Map<string, string>();
const query = document.location.search.substring(1);
const vars = query.split('&');
......@@ -170,7 +168,6 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
verbose: boolean;
skipGettingStarted: boolean;
skipReleaseNotes: boolean;
skipAddToRecentlyOpened: boolean;
mainIPCHandle: string;
sharedIPCHandle: string;
nodeCachedDataDir?: string;
......@@ -179,16 +176,15 @@ export class BrowserWorkbenchEnvironmentService implements IWorkbenchEnvironment
disableCrashReporter: boolean;
driverHandle?: string;
driverVerbose: boolean;
webviewEndpoint?: string;
galleryMachineIdResource?: URI;
readonly logFile: URI;
get webviewResourceRoot(): string {
return this.webviewEndpoint ? this.webviewEndpoint + '/vscode-resource{{resource}}' : 'vscode-resource:{{resource}}';
return this.options.webviewEndpoint ? `${this.options.webviewEndpoint}/vscode-resource{{resource}}` : 'vscode-resource:{{resource}}';
}
get webviewCspSource(): string {
return this.webviewEndpoint ? this.webviewEndpoint : 'vscode-resource:';
return this.options.webviewEndpoint ? this.options.webviewEndpoint : 'vscode-resource:';
}
}
......
......@@ -5,7 +5,7 @@
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IEnvironmentService, IDebugParams } from 'vs/platform/environment/common/environment';
import { IWorkbenchConstructionOptions } from 'vs/workbench/workbench.web.api';
import { URI } from 'vs/base/common/uri';
......@@ -17,7 +17,17 @@ export interface IWorkbenchEnvironmentService extends IEnvironmentService {
readonly configuration: IWindowConfiguration;
readonly options?: IWorkbenchConstructionOptions;
readonly logFile: URI;
readonly logExtensionHostCommunication: boolean;
readonly debugSearch: IDebugParams;
readonly webviewResourceRoot: string;
readonly webviewCspSource: string;
readonly skipGettingStarted: boolean | undefined;
readonly skipReleaseNotes: boolean | undefined;
readonly options?: IWorkbenchConstructionOptions;
}
......@@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
import { EnvironmentService, parseSearchPort } from 'vs/platform/environment/node/environmentService';
import { IWindowConfiguration } from 'vs/platform/windows/common/windows';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { memoize } from 'vs/base/common/decorators';
......@@ -12,27 +12,36 @@ import { Schemas } from 'vs/base/common/network';
import { toBackupWorkspaceResource } from 'vs/workbench/services/backup/common/backup';
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { join } from 'vs/base/common/path';
import { IDebugParams } from 'vs/platform/environment/common/environment';
export class WorkbenchEnvironmentService extends EnvironmentService implements IWorkbenchEnvironmentService {
_serviceBrand!: ServiceIdentifier<any>;
readonly webviewResourceRoot = 'vscode-resource:{{resource}}';
readonly webviewCspSource = 'vscode-resource:';
constructor(
private _configuration: IWindowConfiguration,
readonly configuration: IWindowConfiguration,
execPath: string
) {
super(_configuration, execPath);
super(configuration, execPath);
this._configuration.backupWorkspaceResource = this._configuration.backupPath ? toBackupWorkspaceResource(this._configuration.backupPath, this) : undefined;
this.configuration.backupWorkspaceResource = this.configuration.backupPath ? toBackupWorkspaceResource(this.configuration.backupPath, this) : undefined;
}
get configuration(): IWindowConfiguration {
return this._configuration;
}
get skipGettingStarted(): boolean { return !!this.args['skip-getting-started']; }
get skipReleaseNotes(): boolean { return !!this.args['skip-release-notes']; }
@memoize
get userRoamingDataHome(): URI { return this.appSettingsHome.with({ scheme: Schemas.userData }); }
@memoize
get logFile(): URI { return URI.file(join(this.logsPath, `renderer${this.configuration.windowId}.log`)); }
get logExtensionHostCommunication(): boolean { return !!this.args.logExtensionHostCommunication; }
@memoize
get debugSearch(): IDebugParams { return parseSearchPort(this.args, this.isBuilt); }
}
......@@ -8,7 +8,7 @@ import { Emitter, Event } from 'vs/base/common/event';
import { Disposable, IDisposable } from 'vs/base/common/lifecycle';
import * as strings from 'vs/base/common/strings';
import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ExtHostCustomersRegistry } from 'vs/workbench/api/common/extHostCustomers';
import { ExtHostContext, ExtHostExtensionServiceShape, IExtHostContext, MainContext } from 'vs/workbench/api/common/extHost.protocol';
......@@ -59,7 +59,7 @@ export class ExtensionHostProcessManager extends Disposable {
private readonly _remoteAuthority: string,
initialActivationEvents: string[],
@IInstantiationService private readonly _instantiationService: IInstantiationService,
@IEnvironmentService private readonly _environmentService: IEnvironmentService,
@IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService,
) {
super();
this._extensionHostProcessFinishedActivateEvents = Object.create(null);
......
......@@ -5,7 +5,7 @@
import { Emitter, Event } from 'vs/base/common/event';
import { IMessagePassingProtocol } from 'vs/base/parts/ipc/common/ipc';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { ILabelService } from 'vs/platform/label/common/label';
import { ILogService } from 'vs/platform/log/common/log';
import { connectRemoteAgentExtensionHost, IRemoteExtensionHostStartParams, IConnectionOptions, ISocketFactory } from 'vs/platform/remote/common/remoteAgentConnection';
......@@ -49,7 +49,7 @@ export class RemoteExtensionHostClient extends Disposable implements IExtensionH
private readonly _initDataProvider: IInitDataProvider,
private readonly _socketFactory: ISocketFactory,
@IWorkspaceContextService private readonly _contextService: IWorkspaceContextService,
@IEnvironmentService private readonly _environmentService: IEnvironmentService,
@IWorkbenchEnvironmentService private readonly _environmentService: IWorkbenchEnvironmentService,
@ITelemetryService private readonly _telemetryService: ITelemetryService,
@ILifecycleService private readonly _lifecycleService: ILifecycleService,
@ILogService private readonly _logService: ILogService,
......
......@@ -12,7 +12,8 @@ import { URI as uri } from 'vs/base/common/uri';
import { getNextTickChannel } from 'vs/base/parts/ipc/common/ipc';
import { Client, IIPCOptions } from 'vs/base/parts/ipc/node/ipc.cp';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IDebugParams, IEnvironmentService } from 'vs/platform/environment/common/environment';
import { IDebugParams } from 'vs/platform/environment/common/environment';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
import { IFileService } from 'vs/platform/files/common/files';
import { ILogService } from 'vs/platform/log/common/log';
import { FileMatch, IFileMatch, IFileQuery, IProgressMessage, IRawSearchService, ISearchComplete, ISearchConfiguration, ISearchProgressItem, ISearchResultProvider, ISerializedFileMatch, ISerializedSearchComplete, ISerializedSearchProgressItem, isSerializedSearchComplete, isSerializedSearchSuccess, ITextQuery, ISearchService } from 'vs/workbench/services/search/common/search';
......@@ -35,7 +36,7 @@ export class LocalSearchService extends SearchService {
@ILogService logService: ILogService,
@IExtensionService extensionService: IExtensionService,
@IFileService fileService: IFileService,
@IEnvironmentService readonly environmentService: IEnvironmentService,
@IWorkbenchEnvironmentService readonly environmentService: IWorkbenchEnvironmentService,
@IInstantiationService readonly instantiationService: IInstantiationService
) {
super(modelService, untitledEditorService, editorService, telemetryService, logService, extensionService, fileService);
......@@ -204,4 +205,4 @@ export class DiskSearch implements ISearchResultProvider {
}
}
registerSingleton(ISearchService, LocalSearchService, true);
\ No newline at end of file
registerSingleton(ISearchService, LocalSearchService, true);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册