diff --git a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts index 6cdcb6a401c..72df42a48f1 100644 --- a/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts +++ b/src/vs/code/electron-browser/sharedProcess/sharedProcessMain.ts @@ -13,7 +13,7 @@ import { StaticRouter, ProxyChannel } from 'vs/base/parts/ipc/common/ipc'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; import { ExtensionManagementChannel, ExtensionTipsChannel } from 'vs/platform/extensionManagement/common/extensionManagementIpc'; import { IExtensionManagementService, IExtensionGalleryService, IGlobalExtensionEnablementService, IExtensionTipsService } from 'vs/platform/extensionManagement/common/extensionManagement'; @@ -143,7 +143,6 @@ class SharedProcessMain extends Disposable { // Environment const environmentService = new NativeEnvironmentService(this.configuration.args); - services.set(IEnvironmentService, environmentService); services.set(INativeEnvironmentService, environmentService); // Log diff --git a/src/vs/code/electron-main/main.ts b/src/vs/code/electron-main/main.ts index a9f65257a3b..63494a0d650 100644 --- a/src/vs/code/electron-main/main.ts +++ b/src/vs/code/electron-main/main.ts @@ -23,7 +23,6 @@ import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { ILogService, ConsoleMainLogger, MultiplexLogService, getLogLevel, ILoggerService } from 'vs/platform/log/common/log'; import { StateService } from 'vs/platform/state/node/stateService'; import { IStateService } from 'vs/platform/state/node/state'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { NativeParsedArgs } from 'vs/platform/environment/common/argv'; import { IConfigurationService } from 'vs/platform/configuration/common/configuration'; import { ConfigurationService } from 'vs/platform/configuration/common/configurationService'; @@ -132,8 +131,6 @@ class CodeMain { // Environment const environmentMainService = new EnvironmentMainService(args); const instanceEnvironment = this.patchEnvironment(environmentMainService); // Patch `process.env` with the instance's environment - services.set(IEnvironmentService, environmentMainService); - services.set(INativeEnvironmentService, environmentMainService); services.set(IEnvironmentMainService, environmentMainService); // Log: We need to buffer the spdlog logs until we are sure diff --git a/src/vs/code/node/cliProcessMain.ts b/src/vs/code/node/cliProcessMain.ts index 8c3d305ce5c..7980eb79f66 100644 --- a/src/vs/code/node/cliProcessMain.ts +++ b/src/vs/code/node/cliProcessMain.ts @@ -13,7 +13,7 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { NativeParsedArgs } from 'vs/platform/environment/common/argv'; import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; import { IExtensionManagementService, IExtensionGalleryService, IExtensionManagementCLIService } from 'vs/platform/extensionManagement/common/extensionManagement'; @@ -96,7 +96,6 @@ class CliMain extends Disposable { // Environment const environmentService = new NativeEnvironmentService(this.argv); - services.set(IEnvironmentService, environmentService); services.set(INativeEnvironmentService, environmentService); // Init folders diff --git a/src/vs/platform/environment/common/environment.ts b/src/vs/platform/environment/common/environment.ts index c84e7a62906..87a3fa35263 100644 --- a/src/vs/platform/environment/common/environment.ts +++ b/src/vs/platform/environment/common/environment.ts @@ -3,12 +3,12 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; +import { createDecorator, refineServiceDecorator } from 'vs/platform/instantiation/common/instantiation'; import { URI } from 'vs/base/common/uri'; import { NativeParsedArgs } from 'vs/platform/environment/common/argv'; export const IEnvironmentService = createDecorator('environmentService'); -export const INativeEnvironmentService = createDecorator('nativeEnvironmentService'); +export const INativeEnvironmentService = refineServiceDecorator(IEnvironmentService); export interface IDebugParams { port: number | null; diff --git a/src/vs/platform/environment/electron-main/environmentMainService.ts b/src/vs/platform/environment/electron-main/environmentMainService.ts index abb531546cc..916e4e00a45 100644 --- a/src/vs/platform/environment/electron-main/environmentMainService.ts +++ b/src/vs/platform/environment/electron-main/environmentMainService.ts @@ -5,13 +5,13 @@ import { join } from 'vs/base/common/path'; import { memoize } from 'vs/base/common/decorators'; -import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; -import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { refineServiceDecorator } from 'vs/platform/instantiation/common/instantiation'; +import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService'; import { createStaticIPCHandle } from 'vs/base/parts/ipc/node/ipc.net'; import product from 'vs/platform/product/common/product'; -export const IEnvironmentMainService = createDecorator('environmentMainService'); +export const IEnvironmentMainService = refineServiceDecorator(IEnvironmentService); /** * A subclass of the `INativeEnvironmentService` to be used only in electron-main diff --git a/src/vs/workbench/browser/web.main.ts b/src/vs/workbench/browser/web.main.ts index 42eeeacd3d7..9aea863b585 100644 --- a/src/vs/workbench/browser/web.main.ts +++ b/src/vs/workbench/browser/web.main.ts @@ -60,7 +60,6 @@ import { IUriIdentityService } from 'vs/workbench/services/uriIdentity/common/ur import { UriIdentityService } from 'vs/workbench/services/uriIdentity/common/uriIdentityService'; import { BrowserWindow } from 'vs/workbench/browser/window'; import { ITimerService } from 'vs/workbench/services/timer/browser/timerService'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; class BrowserMain extends Disposable { @@ -151,7 +150,6 @@ class BrowserMain extends Disposable { // Environment const logsPath = URI.file(toLocalISOString(new Date()).replace(/-|:|\.\d+Z$/g, '')).with({ scheme: 'vscode-log' }); const environmentService = new BrowserWorkbenchEnvironmentService({ workspaceId: payload.id, logsPath, ...this.configuration }, productService); - serviceCollection.set(IEnvironmentService, environmentService); serviceCollection.set(IWorkbenchEnvironmentService, environmentService); // Log diff --git a/src/vs/workbench/electron-browser/desktop.main.ts b/src/vs/workbench/electron-browser/desktop.main.ts index 93f8bd5bd88..f82b9bdd2c5 100644 --- a/src/vs/workbench/electron-browser/desktop.main.ts +++ b/src/vs/workbench/electron-browser/desktop.main.ts @@ -15,7 +15,6 @@ import { onUnexpectedError } from 'vs/base/common/errors'; import { URI } from 'vs/base/common/uri'; import { WorkspaceService } from 'vs/workbench/services/configuration/browser/configurationService'; import { NativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchConfiguration, INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, IWorkspaceInitializationPayload, reviveIdentifier } from 'vs/platform/workspaces/common/workspaces'; @@ -52,7 +51,6 @@ import { KeyboardLayoutService } from 'vs/workbench/services/keybinding/electron import { IKeyboardLayoutService } from 'vs/platform/keyboardLayout/common/keyboardLayout'; import { ElectronIPCMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService'; import { LoggerChannelClient } from 'vs/platform/log/common/logIpc'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; class DesktopMain extends Disposable { @@ -162,9 +160,6 @@ class DesktopMain extends Disposable { serviceCollection.set(IMainProcessService, mainProcessService); // Environment - serviceCollection.set(IEnvironmentService, this.environmentService); - serviceCollection.set(INativeEnvironmentService, this.environmentService); - serviceCollection.set(IWorkbenchEnvironmentService, this.environmentService); serviceCollection.set(INativeWorkbenchEnvironmentService, this.environmentService); // Product diff --git a/src/vs/workbench/electron-sandbox/desktop.main.ts b/src/vs/workbench/electron-sandbox/desktop.main.ts index 02389b6b1c7..7e766386930 100644 --- a/src/vs/workbench/electron-sandbox/desktop.main.ts +++ b/src/vs/workbench/electron-sandbox/desktop.main.ts @@ -11,7 +11,6 @@ import { setZoomLevel, setZoomFactor, setFullscreen } from 'vs/base/browser/brow import { domContentLoaded } from 'vs/base/browser/dom'; import { onUnexpectedError } from 'vs/base/common/errors'; import { URI } from 'vs/base/common/uri'; -import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWorkbenchConfiguration, INativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-sandbox/environmentService'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier, IWorkspaceInitializationPayload, reviveIdentifier } from 'vs/platform/workspaces/common/workspaces'; @@ -44,7 +43,6 @@ import { IKeyboardLayoutService } from 'vs/platform/keyboardLayout/common/keyboa import { ElectronIPCMainProcessService } from 'vs/platform/ipc/electron-sandbox/mainProcessService'; import { SimpleConfigurationService, simpleFileSystemProvider, SimpleSignService, SimpleNativeWorkbenchEnvironmentService, SimpleWorkspaceService, SimpleLogService } from 'vs/workbench/electron-sandbox/sandbox.simpleservices'; import { LoggerChannelClient } from 'vs/platform/log/common/logIpc'; -import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; class DesktopMain extends Disposable { @@ -146,9 +144,6 @@ class DesktopMain extends Disposable { serviceCollection.set(IMainProcessService, mainProcessService); // Environment - serviceCollection.set(IEnvironmentService, this.environmentService); - serviceCollection.set(INativeEnvironmentService, this.environmentService); - serviceCollection.set(IWorkbenchEnvironmentService, this.environmentService); serviceCollection.set(INativeWorkbenchEnvironmentService, this.environmentService); // Product diff --git a/src/vs/workbench/services/environment/common/environmentService.ts b/src/vs/workbench/services/environment/common/environmentService.ts index f08de335ece..094d022f64d 100644 --- a/src/vs/workbench/services/environment/common/environmentService.ts +++ b/src/vs/workbench/services/environment/common/environmentService.ts @@ -3,13 +3,13 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; +import { refineServiceDecorator } from 'vs/platform/instantiation/common/instantiation'; import { IWindowConfiguration } from 'vs/platform/windows/common/windows'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import type { IWorkbenchConstructionOptions as IWorkbenchOptions } from 'vs/workbench/workbench.web.api'; import { URI } from 'vs/base/common/uri'; -export const IWorkbenchEnvironmentService = createDecorator('workbenchEnvironmentService'); +export const IWorkbenchEnvironmentService = refineServiceDecorator(IEnvironmentService); export interface IWorkbenchConfiguration extends IWindowConfiguration { } diff --git a/src/vs/workbench/services/environment/electron-sandbox/environmentService.ts b/src/vs/workbench/services/environment/electron-sandbox/environmentService.ts index 932ab448e54..dde8584156b 100644 --- a/src/vs/workbench/services/environment/electron-sandbox/environmentService.ts +++ b/src/vs/workbench/services/environment/electron-sandbox/environmentService.ts @@ -5,10 +5,10 @@ import { IWorkbenchConfiguration, IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService'; import { INativeWindowConfiguration, IOSConfiguration } from 'vs/platform/windows/common/windows'; -import { INativeEnvironmentService } from 'vs/platform/environment/common/environment'; -import { createDecorator } from 'vs/platform/instantiation/common/instantiation'; +import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/environment/common/environment'; +import { refineServiceDecorator } from 'vs/platform/instantiation/common/instantiation'; -export const INativeWorkbenchEnvironmentService = createDecorator('nativeWorkbenchEnvironmentService'); +export const INativeWorkbenchEnvironmentService = refineServiceDecorator(IEnvironmentService); export interface INativeWorkbenchConfiguration extends IWorkbenchConfiguration, INativeWindowConfiguration { }