Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/extension/onboardDebug/common/launchConfigService.ts
13399 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 * as l10n from '@vscode/l10n';
7
import type * as vscode from 'vscode';
8
import { createServiceIdentifier } from '../../../util/common/services';
9
import { URI } from '../../../util/vs/base/common/uri';
10
11
export const needsWorkspaceFolderForTaskError = () => l10n.t`The model asked to run a build task, which requires a workspace folder. Please open a folder and retry.`;
12
13
export interface ILaunchConfigService {
14
_serviceBrand: undefined;
15
16
/**
17
* Adds the launch configuration and/or inputs to the user's launch.json.
18
*/
19
add(workspaceFolder: URI | undefined, config: ILaunchJSON): Promise<void>;
20
21
/**
22
* Opens the user's launch.json. Optionally show the new configuration.
23
*/
24
show(workspaceFolder: URI, showConfigName?: string): Promise<void>;
25
26
/**
27
* Launches the debug configuration.
28
*/
29
launch(config: ILaunchJSON | vscode.DebugConfiguration): Promise<void>;
30
31
/**
32
* Resolves the configuration inputs in the given launch.json.
33
*/
34
resolveConfigurationInputs(launchJson: ILaunchJSON, defaults?: Map<string, string>, interactor?: ICommandInteractor): Promise<{ config: vscode.DebugConfiguration; inputs: Map<string, string> } | undefined>;
35
}
36
37
export const ILaunchConfigService = createServiceIdentifier<ILaunchConfigService>('ILaunchConfigService');
38
39
/** Describes the contents of launch.json */
40
export interface ILaunchJSON {
41
configurations: vscode.DebugConfiguration[];
42
inputs?: {
43
type: string;
44
id: string;
45
description: string;
46
options: string[];
47
}[];
48
}
49
50
export interface ITasksJSON {
51
tasks: vscode.TaskDefinition[];
52
}
53
54
export interface ICommandInteractor {
55
isGenerating(): void;
56
prompt(text: string, defaultValue?: string): Promise<string | undefined>;
57
ensureTask(workspaceFolder: URI | undefined, definition: vscode.TaskDefinition): Promise<boolean>;
58
}
59
60