Path: blob/main/src/vs/workbench/services/extensions/common/extensionDevOptions.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 { Schemas } from '../../../../base/common/network.js';6import { IEnvironmentService } from '../../../../platform/environment/common/environment.js';78export interface IExtensionDevOptions {9readonly isExtensionDevHost: boolean;10readonly isExtensionDevDebug: boolean;11readonly isExtensionDevDebugBrk: boolean;12readonly isExtensionDevTestFromCli: boolean;13}1415export function parseExtensionDevOptions(environmentService: IEnvironmentService): IExtensionDevOptions {16// handle extension host lifecycle a bit special when we know we are developing an extension that runs inside17const isExtensionDevHost = environmentService.isExtensionDevelopment;1819let debugOk = true;20const extDevLocs = environmentService.extensionDevelopmentLocationURI;21if (extDevLocs) {22for (const x of extDevLocs) {23if (x.scheme !== Schemas.file) {24debugOk = false;25}26}27}2829const isExtensionDevDebug = debugOk && typeof environmentService.debugExtensionHost.port === 'number';30const isExtensionDevDebugBrk = debugOk && !!environmentService.debugExtensionHost.break;31const isExtensionDevTestFromCli = isExtensionDevHost && !!environmentService.extensionTestsLocationURI && !environmentService.debugExtensionHost.debugId;32return {33isExtensionDevHost,34isExtensionDevDebug,35isExtensionDevDebugBrk,36isExtensionDevTestFromCli37};38}394041