Path: blob/main/src/vs/platform/environment/common/environment.ts
3296 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;6061// --- settings sync62userDataSyncHome: URI;63sync: 'on' | 'off' | undefined;6465// --- continue edit session66continueOn?: string;67editSessionId?: string;6869// --- extension development70debugExtensionHost: IExtensionHostDebugParams;71isExtensionDevelopment: boolean;72disableExtensions: boolean | string[];73enableExtensions?: readonly string[];74extensionDevelopmentLocationURI?: URI[];75extensionDevelopmentKind?: ExtensionKind[];76extensionTestsLocationURI?: URI;7778// --- logging79logsHome: URI;80logLevel?: string;81extensionLogLevel?: [string, string][];82verbose: boolean;83isBuilt: boolean;8485// --- telemetry/exp86disableTelemetry: boolean;87disableExperiments: boolean;88serviceMachineIdResource: URI;8990// --- Policy91policyFile?: URI;9293// -- Simulation94isSimulation?: boolean;9596// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!97//98// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.99//100// AS SUCH:101// - PUT NON-WEB PROPERTIES INTO NATIVE ENVIRONMENT SERVICE102// - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE103// - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE104//105// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!106}107108/**109* A subclass of the `IEnvironmentService` to be used only in native110* environments (Windows, Linux, macOS) but not e.g. web.111*/112export interface INativeEnvironmentService extends IEnvironmentService {113114// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!115//116// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.117//118// AS SUCH:119// - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE120// - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE121//122// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!123124// --- CLI Arguments125args: NativeParsedArgs;126127// --- data paths128/**129* Root path of the JavaScript sources.130*131* Note: This is NOT the installation root132* directory itself but contained in it at133* a level that is platform dependent.134*/135appRoot: string;136userHome: URI;137appSettingsHome: URI;138tmpDir: URI;139userDataPath: string;140141// --- extensions142extensionsPath: string;143extensionsDownloadLocation: URI;144builtinExtensionsPath: string;145146// --- use in-memory Secret Storage147useInMemorySecretStorage?: boolean;148149crossOriginIsolated?: boolean;150151// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!152//153// NOTE: KEEP THIS INTERFACE AS SMALL AS POSSIBLE.154//155// AS SUCH:156// - PUT NON-WEB PROPERTIES INTO NATIVE ENVIRONMENT SERVICE157// - PUT WORKBENCH ONLY PROPERTIES INTO WORKBENCH ENVIRONMENT SERVICE158// - PUT ELECTRON-MAIN ONLY PROPERTIES INTO MAIN ENVIRONMENT SERVICE159//160// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!161}162163164