-
Notifications
You must be signed in to change notification settings - Fork 886
Expand file tree
/
Copy pathcapabilities.ts
More file actions
96 lines (78 loc) · 3.3 KB
/
capabilities.ts
File metadata and controls
96 lines (78 loc) · 3.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import * as vscode from 'vscode';
import { RunSessionInfo } from './dcp/types';
export type Capability =
| 'prompting' // Support using VS Code to capture user input instead of CLI
| 'baseline.v1'
| 'secret-prompts.v1'
| 'file-pickers.v1'
| 'build-dotnet-using-cli' // Support building .NET projects using the CLI
| 'devkit' // Support for .NET DevKit extension (old, used for determining whether to build .NET projects in extension)
| 'ms-dotnettools.csdevkit' // Older AppHost versions used this extension identifier instead of devkit
| 'project' // Support for running C# projects
| 'ms-dotnettools.csharp' // Older AppHost versions used this extension identifier instead of project
| 'python' // Support for running Python projects
| 'ms-python.python' // Older AppHost versions used this extension identifier instead of python
| 'go' // Support for running Go projects
| 'golang.go' // Older AppHost versions used this extension identifier instead of go
| 'node' // Support for running Node.js projects
| 'browser' // Support for browser debugging (built-in to VS Code via js-debug)
| 'azure-functions'; // Support for running Azure Functions projects
export type Capabilities = Capability[];
function isExtensionInstalled(extensionId: string): boolean {
const extension = vscode.extensions.getExtension(extensionId);
return !!extension;
}
export function isCsDevKitInstalled() {
return isExtensionInstalled("ms-dotnettools.csdevkit");
}
export function isCsharpInstalled() {
return isExtensionInstalled("ms-dotnettools.csharp");
}
export function isPythonInstalled() {
return isExtensionInstalled("ms-python.python");
}
export function isGoInstalled() {
return isExtensionInstalled("golang.go");
}
export function isAzureFunctionsExtensionInstalled() {
return isExtensionInstalled("ms-azuretools.vscode-azurefunctions");
}
export function isNodeInstalled() {
// Node.js debugging uses VS Code's built-in js-debug, no extension needed
return true;
}
export function getSupportedCapabilities(): Capabilities {
const capabilities: Capabilities = ['prompting', 'baseline.v1', 'secret-prompts.v1', 'file-pickers.v1', 'build-dotnet-using-cli'];
if (isCsDevKitInstalled()) {
capabilities.push("devkit");
capabilities.push("ms-dotnettools.csdevkit");
}
if (isCsharpInstalled()) {
capabilities.push("project");
capabilities.push("ms-dotnettools.csharp");
// Azure Functions debugging requires both C# (coreclr attach to the worker
// process) and the Azure Functions extension (to launch func host start).
if (isAzureFunctionsExtensionInstalled()) {
capabilities.push("azure-functions");
}
}
if (isPythonInstalled()) {
capabilities.push("python");
capabilities.push("ms-python.python");
}
if (isGoInstalled()) {
capabilities.push("go");
capabilities.push("golang.go");
}
if (isNodeInstalled()) {
capabilities.push("node");
capabilities.push("browser");
}
return capabilities;
}
export function getRunSessionInfo(): RunSessionInfo {
return {
protocols_supported: ["2024-03-03", "2024-04-23", "2025-10-01"],
supported_launch_configurations: getSupportedCapabilities()
};
}