Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/workbench/services/extensions/common/extensionDevOptions.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { Schemas } from '../../../../base/common/network.js';
7
import { IEnvironmentService } from '../../../../platform/environment/common/environment.js';
8
9
export interface IExtensionDevOptions {
10
readonly isExtensionDevHost: boolean;
11
readonly isExtensionDevDebug: boolean;
12
readonly isExtensionDevDebugBrk: boolean;
13
readonly isExtensionDevTestFromCli: boolean;
14
}
15
16
export function parseExtensionDevOptions(environmentService: IEnvironmentService): IExtensionDevOptions {
17
// handle extension host lifecycle a bit special when we know we are developing an extension that runs inside
18
const isExtensionDevHost = environmentService.isExtensionDevelopment;
19
20
let debugOk = true;
21
const extDevLocs = environmentService.extensionDevelopmentLocationURI;
22
if (extDevLocs) {
23
for (const x of extDevLocs) {
24
if (x.scheme !== Schemas.file) {
25
debugOk = false;
26
}
27
}
28
}
29
30
const isExtensionDevDebug = debugOk && typeof environmentService.debugExtensionHost.port === 'number';
31
const isExtensionDevDebugBrk = debugOk && !!environmentService.debugExtensionHost.break;
32
const isExtensionDevTestFromCli = isExtensionDevHost && !!environmentService.extensionTestsLocationURI && !environmentService.debugExtensionHost.debugId;
33
return {
34
isExtensionDevHost,
35
isExtensionDevDebug,
36
isExtensionDevDebugBrk,
37
isExtensionDevTestFromCli
38
};
39
}
40
41