Path: blob/main/src/vs/platform/environment/common/environment.ts
5240 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { URI } from '../../../base/common/uri.js';6import { NativeParsedArgs } from './argv.js';7import { createDecorator, refineServiceDecorator } from '../../instantiation/common/instantiation.js';89export const IEnvironmentService = createDecorator<IEnvironmentService>('environmentService');10export const INativeEnvironmentService = refineServiceDecorator<IEnvironmentService, INativeEnvironmentService>(IEnvironmentService);1112export interface IDebugParams {13port: number | null;14break: boolean;15}1617export interface IExtensionHostDebugParams extends IDebugParams {18debugId?: string;19env?: Record<string, string>;20}2122/**23* Type of extension.24*25* **NOTE**: This is defined in `platform/environment` because it can appear as a CLI argument.26*/27export type ExtensionKind = 'ui' | 'workspace' | 'web';2829/**30* A basic environment service that can be used in various processes,31* such as main, renderer and shared process. Use subclasses of this32* service for specific environment.33*/34export interface IEnvironmentService {3536readonly _serviceBrand: undefined;3738// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!39//40// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.41//42// AS SUCH:43// - PUT NON-WEB PROPERTIES INTO NATIVE ENVIRONMENT SERVICE44// - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE45// - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE46//47// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!4849// --- user roaming data50stateResource: URI;51userRoamingDataHome: URI;52keyboardLayoutResource: URI;53argvResource: URI;5455// --- data paths56untitledWorkspacesHome: URI;57workspaceStorageHome: URI;58localHistoryHome: URI;59cacheHome: URI;60builtinWorkbenchModesHome: URI;6162// --- settings sync63userDataSyncHome: URI;64sync: 'on' | 'off' | undefined;6566// --- continue edit session67continueOn?: string;68editSessionId?: string;6970// --- extension development71debugExtensionHost: IExtensionHostDebugParams;72isExtensionDevelopment: boolean;73disableExtensions: boolean | string[];74enableExtensions?: readonly string[];75extensionDevelopmentLocationURI?: URI[];76extensionDevelopmentKind?: ExtensionKind[];77extensionTestsLocationURI?: URI;7879// --- logging80logsHome: URI;81logLevel?: string;82extensionLogLevel?: [string, string][];83verbose: boolean;84isBuilt: boolean;8586// --- telemetry/exp87disableTelemetry: boolean;88disableExperiments: boolean;89serviceMachineIdResource: URI;9091// --- agent sessions workspace92agentSessionsWorkspace?: URI;9394// --- Policy95policyFile?: URI;9697// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!98//99// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.100//101// AS SUCH:102// - PUT NON-WEB PROPERTIES INTO NATIVE ENVIRONMENT SERVICE103// - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE104// - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE105//106// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!107}108109/**110* A subclass of the `IEnvironmentService` to be used only in native111* environments (Windows, Linux, macOS) but not e.g. web.112*/113export interface INativeEnvironmentService extends IEnvironmentService {114115// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!116//117// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.118//119// AS SUCH:120// - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE121// - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE122//123// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!124125// --- CLI Arguments126args: NativeParsedArgs;127128// --- data paths129/**130* Root path of the JavaScript sources.131*132* Note: This is NOT the installation root133* directory itself but contained in it at134* a level that is platform dependent.135*/136appRoot: string;137userHome: URI;138appSettingsHome: URI;139tmpDir: URI;140userDataPath: string;141142// --- extensions143extensionsPath: string;144extensionsDownloadLocation: URI;145builtinExtensionsPath: string;146147// --- use in-memory Secret Storage148useInMemorySecretStorage?: boolean;149150crossOriginIsolated?: boolean;151exportPolicyData?: string;152153// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!154//155// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.156//157// AS SUCH:158// - PUT NON-WEB PROPERTIES INTO NATIVE ENVIRONMENT SERVICE159// - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE160// - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE161//162// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!163}164165166