@codingame/monaco-vscode-task-service-override 1.85.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/external/tslib/tslib.es6.js +11 -0
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/override/vs/platform/dialogs/common/dialogs.js +8 -0
- package/package.json +24 -0
- package/task.d.ts +5 -0
- package/task.js +12 -0
- package/vscode/src/vs/base/common/parsers.js +44 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/abstractTaskService.js +3851 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/runAutomaticTasks.js +167 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/task.contribution.js +694 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/taskQuickPick.js +452 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/taskService.js +36 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/taskTerminalStatus.js +191 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/tasksQuickAccess.js +121 -0
- package/vscode/src/vs/workbench/contrib/tasks/browser/terminalTaskSystem.js +1713 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/jsonSchemaCommon.js +440 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/jsonSchema_v1.js +125 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/jsonSchema_v2.js +901 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/problemCollectors.js +464 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/problemMatcher.js +1796 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/taskConfiguration.js +1581 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/taskSystem.js +15 -0
- package/vscode/src/vs/workbench/contrib/tasks/common/taskTemplates.js +145 -0
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalEscapeSequences.js +13 -0
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
3
|
+
import * as Objects from 'monaco-editor/esm/vs/base/common/objects.js';
|
|
4
|
+
import { ConfiguringTask, ContributedTask, CustomTask } from 'vscode/vscode/vs/workbench/contrib/tasks/common/tasks';
|
|
5
|
+
import * as Types from 'monaco-editor/esm/vs/base/common/types.js';
|
|
6
|
+
import { ITaskService } from 'vscode/vscode/vs/workbench/contrib/tasks/common/taskService';
|
|
7
|
+
import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
|
|
8
|
+
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
9
|
+
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
10
|
+
import { Event } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
11
|
+
import { Severity, INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
|
|
12
|
+
import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
|
|
13
|
+
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
14
|
+
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
15
|
+
import { registerIcon } from 'monaco-editor/esm/vs/platform/theme/common/iconRegistry.js';
|
|
16
|
+
import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
|
|
17
|
+
import { createColorStyleElement, getColorClass } from 'vscode/vscode/vs/workbench/contrib/terminal/browser/terminalIcon';
|
|
18
|
+
import { showWithPinnedItems } from 'vscode/vscode/vs/platform/quickinput/browser/quickPickPin';
|
|
19
|
+
import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
|
|
20
|
+
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
|
|
21
|
+
|
|
22
|
+
var TaskQuickPick_1;
|
|
23
|
+
const QUICKOPEN_DETAIL_CONFIG = 'task.quickOpen.detail';
|
|
24
|
+
const QUICKOPEN_SKIP_CONFIG = 'task.quickOpen.skip';
|
|
25
|
+
function isWorkspaceFolder(folder) {
|
|
26
|
+
return 'uri' in folder;
|
|
27
|
+
}
|
|
28
|
+
const SHOW_ALL = ( nls.localizeWithPath(
|
|
29
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
30
|
+
'taskQuickPick.showAll',
|
|
31
|
+
"Show All Tasks..."
|
|
32
|
+
));
|
|
33
|
+
const configureTaskIcon = registerIcon('tasks-list-configure', Codicon.gear, ( nls.localizeWithPath(
|
|
34
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
35
|
+
'configureTaskIcon',
|
|
36
|
+
'Configuration icon in the tasks selection list.'
|
|
37
|
+
)));
|
|
38
|
+
const removeTaskIcon = registerIcon('tasks-remove', Codicon.close, ( nls.localizeWithPath(
|
|
39
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
40
|
+
'removeTaskIcon',
|
|
41
|
+
'Icon for remove in the tasks selection list.'
|
|
42
|
+
)));
|
|
43
|
+
const runTaskStorageKey = 'runTaskStorageKey';
|
|
44
|
+
let TaskQuickPick = TaskQuickPick_1 = class TaskQuickPick extends Disposable {
|
|
45
|
+
constructor(_taskService, _configurationService, _quickInputService, _notificationService, _themeService, _dialogService, _storageService) {
|
|
46
|
+
super();
|
|
47
|
+
this._taskService = _taskService;
|
|
48
|
+
this._configurationService = _configurationService;
|
|
49
|
+
this._quickInputService = _quickInputService;
|
|
50
|
+
this._notificationService = _notificationService;
|
|
51
|
+
this._themeService = _themeService;
|
|
52
|
+
this._dialogService = _dialogService;
|
|
53
|
+
this._storageService = _storageService;
|
|
54
|
+
this._sorter = this._taskService.createSorter();
|
|
55
|
+
}
|
|
56
|
+
_showDetail() {
|
|
57
|
+
return !!this._configurationService.getValue(QUICKOPEN_DETAIL_CONFIG);
|
|
58
|
+
}
|
|
59
|
+
_guessTaskLabel(task) {
|
|
60
|
+
if (task._label) {
|
|
61
|
+
return task._label;
|
|
62
|
+
}
|
|
63
|
+
if (ConfiguringTask.is(task)) {
|
|
64
|
+
let label = task.configures.type;
|
|
65
|
+
const configures = Objects.deepClone(task.configures);
|
|
66
|
+
delete configures['_key'];
|
|
67
|
+
delete configures['type'];
|
|
68
|
+
( Object.keys(configures)).forEach(key => label += `: ${configures[key]}`);
|
|
69
|
+
return label;
|
|
70
|
+
}
|
|
71
|
+
return '';
|
|
72
|
+
}
|
|
73
|
+
static getTaskLabelWithIcon(task, labelGuess) {
|
|
74
|
+
const label = labelGuess || task._label;
|
|
75
|
+
const icon = task.configurationProperties.icon;
|
|
76
|
+
if (!icon) {
|
|
77
|
+
return `${label}`;
|
|
78
|
+
}
|
|
79
|
+
return icon.id ? `$(${icon.id}) ${label}` : `$(${Codicon.tools.id}) ${label}`;
|
|
80
|
+
}
|
|
81
|
+
static applyColorStyles(task, entry, themeService) {
|
|
82
|
+
if (task.configurationProperties.icon?.color) {
|
|
83
|
+
const colorTheme = themeService.getColorTheme();
|
|
84
|
+
createColorStyleElement(colorTheme);
|
|
85
|
+
entry.iconClasses = [getColorClass(task.configurationProperties.icon.color)];
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
_createTaskEntry(task, extraButtons = []) {
|
|
89
|
+
const buttons = [
|
|
90
|
+
{ iconClass: ThemeIcon.asClassName(configureTaskIcon), tooltip: ( nls.localizeWithPath(
|
|
91
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
92
|
+
'configureTask',
|
|
93
|
+
"Configure Task"
|
|
94
|
+
)) },
|
|
95
|
+
...extraButtons
|
|
96
|
+
];
|
|
97
|
+
const entry = { label: TaskQuickPick_1.getTaskLabelWithIcon(task, this._guessTaskLabel(task)), description: this._taskService.getTaskDescription(task), task, detail: this._showDetail() ? task.configurationProperties.detail : undefined, buttons };
|
|
98
|
+
TaskQuickPick_1.applyColorStyles(task, entry, this._themeService);
|
|
99
|
+
return entry;
|
|
100
|
+
}
|
|
101
|
+
_createEntriesForGroup(entries, tasks, groupLabel, extraButtons = []) {
|
|
102
|
+
entries.push({ type: 'separator', label: groupLabel });
|
|
103
|
+
tasks.forEach(task => {
|
|
104
|
+
if (!task.configurationProperties.hide) {
|
|
105
|
+
entries.push(this._createTaskEntry(task, extraButtons));
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
_createTypeEntries(entries, types) {
|
|
110
|
+
entries.push({ type: 'separator', label: ( nls.localizeWithPath(
|
|
111
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
112
|
+
'contributedTasks',
|
|
113
|
+
"contributed"
|
|
114
|
+
)) });
|
|
115
|
+
types.forEach(type => {
|
|
116
|
+
entries.push({ label: `$(folder) ${type}`, task: type, ariaLabel: ( nls.localizeWithPath(
|
|
117
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
118
|
+
'taskType',
|
|
119
|
+
"All {0} tasks",
|
|
120
|
+
type
|
|
121
|
+
)) });
|
|
122
|
+
});
|
|
123
|
+
entries.push({ label: SHOW_ALL, task: SHOW_ALL, alwaysShow: true });
|
|
124
|
+
}
|
|
125
|
+
_handleFolderTaskResult(result) {
|
|
126
|
+
const tasks = [];
|
|
127
|
+
Array.from(result).forEach(([key, folderTasks]) => {
|
|
128
|
+
if (folderTasks.set) {
|
|
129
|
+
tasks.push(...folderTasks.set.tasks);
|
|
130
|
+
}
|
|
131
|
+
if (folderTasks.configurations) {
|
|
132
|
+
for (const configuration in folderTasks.configurations.byIdentifier) {
|
|
133
|
+
tasks.push(folderTasks.configurations.byIdentifier[configuration]);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
return tasks;
|
|
138
|
+
}
|
|
139
|
+
_dedupeConfiguredAndRecent(recentTasks, configuredTasks) {
|
|
140
|
+
let dedupedConfiguredTasks = [];
|
|
141
|
+
const foundRecentTasks = Array(recentTasks.length).fill(false);
|
|
142
|
+
for (let j = 0; j < configuredTasks.length; j++) {
|
|
143
|
+
const workspaceFolder = configuredTasks[j].getWorkspaceFolder()?.uri.toString();
|
|
144
|
+
const definition = configuredTasks[j].getDefinition()?._key;
|
|
145
|
+
const type = configuredTasks[j].type;
|
|
146
|
+
const label = configuredTasks[j]._label;
|
|
147
|
+
const recentKey = configuredTasks[j].getKey();
|
|
148
|
+
const findIndex = recentTasks.findIndex((value) => {
|
|
149
|
+
return (workspaceFolder && definition && value.getWorkspaceFolder()?.uri.toString() === workspaceFolder
|
|
150
|
+
&& ((value.getDefinition()?._key === definition) || (value.type === type && value._label === label)))
|
|
151
|
+
|| (recentKey && value.getKey() === recentKey);
|
|
152
|
+
});
|
|
153
|
+
if (findIndex === -1) {
|
|
154
|
+
dedupedConfiguredTasks.push(configuredTasks[j]);
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
recentTasks[findIndex] = configuredTasks[j];
|
|
158
|
+
foundRecentTasks[findIndex] = true;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
dedupedConfiguredTasks = dedupedConfiguredTasks.sort((a, b) => this._sorter.compare(a, b));
|
|
162
|
+
const prunedRecentTasks = [];
|
|
163
|
+
for (let i = 0; i < recentTasks.length; i++) {
|
|
164
|
+
if (foundRecentTasks[i] || ConfiguringTask.is(recentTasks[i])) {
|
|
165
|
+
prunedRecentTasks.push(recentTasks[i]);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return { configuredTasks: dedupedConfiguredTasks, recentTasks: prunedRecentTasks };
|
|
169
|
+
}
|
|
170
|
+
async getTopLevelEntries(defaultEntry) {
|
|
171
|
+
if (this._topLevelEntries !== undefined) {
|
|
172
|
+
return { entries: this._topLevelEntries };
|
|
173
|
+
}
|
|
174
|
+
let recentTasks = (await this._taskService.getSavedTasks('historical')).reverse();
|
|
175
|
+
const configuredTasks = this._handleFolderTaskResult(await this._taskService.getWorkspaceTasks());
|
|
176
|
+
const extensionTaskTypes = this._taskService.taskTypes();
|
|
177
|
+
this._topLevelEntries = [];
|
|
178
|
+
const dedupeAndPrune = this._dedupeConfiguredAndRecent(recentTasks, configuredTasks);
|
|
179
|
+
const dedupedConfiguredTasks = dedupeAndPrune.configuredTasks;
|
|
180
|
+
recentTasks = dedupeAndPrune.recentTasks;
|
|
181
|
+
if (recentTasks.length > 0) {
|
|
182
|
+
const removeRecentButton = {
|
|
183
|
+
iconClass: ThemeIcon.asClassName(removeTaskIcon),
|
|
184
|
+
tooltip: ( nls.localizeWithPath(
|
|
185
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
186
|
+
'removeRecent',
|
|
187
|
+
'Remove Recently Used Task'
|
|
188
|
+
))
|
|
189
|
+
};
|
|
190
|
+
this._createEntriesForGroup(this._topLevelEntries, recentTasks, ( nls.localizeWithPath(
|
|
191
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
192
|
+
'recentlyUsed',
|
|
193
|
+
'recently used'
|
|
194
|
+
)), [removeRecentButton]);
|
|
195
|
+
}
|
|
196
|
+
if (configuredTasks.length > 0) {
|
|
197
|
+
if (dedupedConfiguredTasks.length > 0) {
|
|
198
|
+
this._createEntriesForGroup(this._topLevelEntries, dedupedConfiguredTasks, ( nls.localizeWithPath(
|
|
199
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
200
|
+
'configured',
|
|
201
|
+
'configured'
|
|
202
|
+
)));
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
if (defaultEntry && (configuredTasks.length === 0)) {
|
|
206
|
+
this._topLevelEntries.push({ type: 'separator', label: ( nls.localizeWithPath(
|
|
207
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
208
|
+
'configured',
|
|
209
|
+
'configured'
|
|
210
|
+
)) });
|
|
211
|
+
this._topLevelEntries.push(defaultEntry);
|
|
212
|
+
}
|
|
213
|
+
if (extensionTaskTypes.length > 0) {
|
|
214
|
+
this._createTypeEntries(this._topLevelEntries, extensionTaskTypes);
|
|
215
|
+
}
|
|
216
|
+
return { entries: this._topLevelEntries, isSingleConfigured: configuredTasks.length === 1 ? configuredTasks[0] : undefined };
|
|
217
|
+
}
|
|
218
|
+
async handleSettingOption(selectedType) {
|
|
219
|
+
const { confirmed } = await this._dialogService.confirm({
|
|
220
|
+
type: Severity.Warning,
|
|
221
|
+
message: ( nls.localizeWithPath(
|
|
222
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
223
|
+
'TaskQuickPick.changeSettingDetails',
|
|
224
|
+
"Task detection for {0} tasks causes files in any workspace you open to be run as code. Enabling {0} task detection is a user setting and will apply to any workspace you open. \n\n Do you want to enable {0} task detection for all workspaces?",
|
|
225
|
+
selectedType
|
|
226
|
+
)),
|
|
227
|
+
cancelButton: ( nls.localizeWithPath(
|
|
228
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
229
|
+
'TaskQuickPick.changeSettingNo',
|
|
230
|
+
"No"
|
|
231
|
+
))
|
|
232
|
+
});
|
|
233
|
+
if (confirmed) {
|
|
234
|
+
await this._configurationService.updateValue(`${selectedType}.autoDetect`, 'on');
|
|
235
|
+
await ( new Promise(resolve => setTimeout(() => resolve(), 100)));
|
|
236
|
+
return this.show(( nls.localizeWithPath(
|
|
237
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
238
|
+
'TaskService.pickRunTask',
|
|
239
|
+
'Select the task to run'
|
|
240
|
+
)), undefined, selectedType);
|
|
241
|
+
}
|
|
242
|
+
return undefined;
|
|
243
|
+
}
|
|
244
|
+
async show(placeHolder, defaultEntry, startAtType, name) {
|
|
245
|
+
const picker = this._quickInputService.createQuickPick();
|
|
246
|
+
picker.placeholder = placeHolder;
|
|
247
|
+
picker.matchOnDescription = true;
|
|
248
|
+
picker.ignoreFocusOut = false;
|
|
249
|
+
picker.onDidTriggerItemButton(async (context) => {
|
|
250
|
+
const task = context.item.task;
|
|
251
|
+
if (context.button.iconClass === ThemeIcon.asClassName(removeTaskIcon)) {
|
|
252
|
+
const key = (task && !Types.isString(task)) ? task.getKey() : undefined;
|
|
253
|
+
if (key) {
|
|
254
|
+
this._taskService.removeRecentlyUsedTask(key);
|
|
255
|
+
}
|
|
256
|
+
const indexToRemove = picker.items.indexOf(context.item);
|
|
257
|
+
if (indexToRemove >= 0) {
|
|
258
|
+
picker.items = [...picker.items.slice(0, indexToRemove), ...picker.items.slice(indexToRemove + 1)];
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
else if (context.button.iconClass === ThemeIcon.asClassName(configureTaskIcon)) {
|
|
262
|
+
this._quickInputService.cancel();
|
|
263
|
+
if (ContributedTask.is(task)) {
|
|
264
|
+
this._taskService.customize(task, undefined, true);
|
|
265
|
+
}
|
|
266
|
+
else if (CustomTask.is(task) || ConfiguringTask.is(task)) {
|
|
267
|
+
let canOpenConfig = false;
|
|
268
|
+
try {
|
|
269
|
+
canOpenConfig = await this._taskService.openConfig(task);
|
|
270
|
+
}
|
|
271
|
+
catch (e) {
|
|
272
|
+
}
|
|
273
|
+
if (!canOpenConfig) {
|
|
274
|
+
this._taskService.customize(task, undefined, true);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
if (name) {
|
|
280
|
+
picker.value = name;
|
|
281
|
+
}
|
|
282
|
+
let firstLevelTask = startAtType;
|
|
283
|
+
if (!firstLevelTask) {
|
|
284
|
+
const topLevelEntriesResult = await this.getTopLevelEntries(defaultEntry);
|
|
285
|
+
if (topLevelEntriesResult.isSingleConfigured && this._configurationService.getValue(QUICKOPEN_SKIP_CONFIG)) {
|
|
286
|
+
picker.dispose();
|
|
287
|
+
return this._toTask(topLevelEntriesResult.isSingleConfigured);
|
|
288
|
+
}
|
|
289
|
+
const taskQuickPickEntries = topLevelEntriesResult.entries;
|
|
290
|
+
firstLevelTask = await this._doPickerFirstLevel(picker, taskQuickPickEntries);
|
|
291
|
+
}
|
|
292
|
+
do {
|
|
293
|
+
if (Types.isString(firstLevelTask)) {
|
|
294
|
+
if (name) {
|
|
295
|
+
await this._doPickerFirstLevel(picker, (await this.getTopLevelEntries(defaultEntry)).entries);
|
|
296
|
+
picker.dispose();
|
|
297
|
+
return undefined;
|
|
298
|
+
}
|
|
299
|
+
const selectedEntry = await this.doPickerSecondLevel(picker, firstLevelTask);
|
|
300
|
+
if (selectedEntry && !selectedEntry.settingType && selectedEntry.task === null) {
|
|
301
|
+
picker.value = '';
|
|
302
|
+
firstLevelTask = await this._doPickerFirstLevel(picker, (await this.getTopLevelEntries(defaultEntry)).entries);
|
|
303
|
+
}
|
|
304
|
+
else if (selectedEntry && Types.isString(selectedEntry.settingType)) {
|
|
305
|
+
picker.dispose();
|
|
306
|
+
return this.handleSettingOption(selectedEntry.settingType);
|
|
307
|
+
}
|
|
308
|
+
else {
|
|
309
|
+
picker.dispose();
|
|
310
|
+
return (selectedEntry?.task && !Types.isString(selectedEntry?.task)) ? this._toTask(selectedEntry?.task) : undefined;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
else if (firstLevelTask) {
|
|
314
|
+
picker.dispose();
|
|
315
|
+
return this._toTask(firstLevelTask);
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
picker.dispose();
|
|
319
|
+
return firstLevelTask;
|
|
320
|
+
}
|
|
321
|
+
} while (1);
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
async _doPickerFirstLevel(picker, taskQuickPickEntries) {
|
|
325
|
+
picker.items = taskQuickPickEntries;
|
|
326
|
+
showWithPinnedItems(this._storageService, runTaskStorageKey, picker, true);
|
|
327
|
+
const firstLevelPickerResult = await ( new Promise(resolve => {
|
|
328
|
+
Event.once(picker.onDidAccept)(async () => {
|
|
329
|
+
resolve(picker.selectedItems ? picker.selectedItems[0] : undefined);
|
|
330
|
+
});
|
|
331
|
+
}));
|
|
332
|
+
return firstLevelPickerResult?.task;
|
|
333
|
+
}
|
|
334
|
+
async doPickerSecondLevel(picker, type, name) {
|
|
335
|
+
picker.busy = true;
|
|
336
|
+
if (type === SHOW_ALL) {
|
|
337
|
+
const items = ( (await this._taskService.tasks()).filter(t => !t.configurationProperties.hide).sort((a, b) => this._sorter.compare(a, b)).map(task => this._createTaskEntry(task)));
|
|
338
|
+
items.push(...TaskQuickPick_1.allSettingEntries(this._configurationService));
|
|
339
|
+
picker.items = items;
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
picker.value = name || '';
|
|
343
|
+
picker.items = await this._getEntriesForProvider(type);
|
|
344
|
+
}
|
|
345
|
+
await picker.show();
|
|
346
|
+
picker.busy = false;
|
|
347
|
+
const secondLevelPickerResult = await ( new Promise(resolve => {
|
|
348
|
+
Event.once(picker.onDidAccept)(async () => {
|
|
349
|
+
resolve(picker.selectedItems ? picker.selectedItems[0] : undefined);
|
|
350
|
+
});
|
|
351
|
+
}));
|
|
352
|
+
return secondLevelPickerResult;
|
|
353
|
+
}
|
|
354
|
+
static allSettingEntries(configurationService) {
|
|
355
|
+
const entries = [];
|
|
356
|
+
const gruntEntry = TaskQuickPick_1.getSettingEntry(configurationService, 'grunt');
|
|
357
|
+
if (gruntEntry) {
|
|
358
|
+
entries.push(gruntEntry);
|
|
359
|
+
}
|
|
360
|
+
const gulpEntry = TaskQuickPick_1.getSettingEntry(configurationService, 'gulp');
|
|
361
|
+
if (gulpEntry) {
|
|
362
|
+
entries.push(gulpEntry);
|
|
363
|
+
}
|
|
364
|
+
const jakeEntry = TaskQuickPick_1.getSettingEntry(configurationService, 'jake');
|
|
365
|
+
if (jakeEntry) {
|
|
366
|
+
entries.push(jakeEntry);
|
|
367
|
+
}
|
|
368
|
+
return entries;
|
|
369
|
+
}
|
|
370
|
+
static getSettingEntry(configurationService, type) {
|
|
371
|
+
if (configurationService.getValue(`${type}.autoDetect`) === 'off') {
|
|
372
|
+
return {
|
|
373
|
+
label: ( nls.localizeWithPath(
|
|
374
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
375
|
+
'TaskQuickPick.changeSettingsOptions',
|
|
376
|
+
"$(gear) {0} task detection is turned off. Enable {1} task detection...",
|
|
377
|
+
type[0].toUpperCase() + type.slice(1),
|
|
378
|
+
type
|
|
379
|
+
)),
|
|
380
|
+
task: null,
|
|
381
|
+
settingType: type,
|
|
382
|
+
alwaysShow: true
|
|
383
|
+
};
|
|
384
|
+
}
|
|
385
|
+
return undefined;
|
|
386
|
+
}
|
|
387
|
+
async _getEntriesForProvider(type) {
|
|
388
|
+
const tasks = (await this._taskService.tasks({ type })).sort((a, b) => this._sorter.compare(a, b));
|
|
389
|
+
let taskQuickPickEntries = [];
|
|
390
|
+
if (tasks.length > 0) {
|
|
391
|
+
for (const task of tasks) {
|
|
392
|
+
if (!task.configurationProperties.hide) {
|
|
393
|
+
taskQuickPickEntries.push(this._createTaskEntry(task));
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
taskQuickPickEntries.push({
|
|
397
|
+
type: 'separator'
|
|
398
|
+
}, {
|
|
399
|
+
label: ( nls.localizeWithPath(
|
|
400
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
401
|
+
'TaskQuickPick.goBack',
|
|
402
|
+
'Go back ↩'
|
|
403
|
+
)),
|
|
404
|
+
task: null,
|
|
405
|
+
alwaysShow: true
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
else {
|
|
409
|
+
taskQuickPickEntries = [{
|
|
410
|
+
label: ( nls.localizeWithPath(
|
|
411
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
412
|
+
'TaskQuickPick.noTasksForType',
|
|
413
|
+
'No {0} tasks found. Go back ↩',
|
|
414
|
+
type
|
|
415
|
+
)),
|
|
416
|
+
task: null,
|
|
417
|
+
alwaysShow: true
|
|
418
|
+
}];
|
|
419
|
+
}
|
|
420
|
+
const settingEntry = TaskQuickPick_1.getSettingEntry(this._configurationService, type);
|
|
421
|
+
if (settingEntry) {
|
|
422
|
+
taskQuickPickEntries.push(settingEntry);
|
|
423
|
+
}
|
|
424
|
+
return taskQuickPickEntries;
|
|
425
|
+
}
|
|
426
|
+
async _toTask(task) {
|
|
427
|
+
if (!ConfiguringTask.is(task)) {
|
|
428
|
+
return task;
|
|
429
|
+
}
|
|
430
|
+
const resolvedTask = await this._taskService.tryResolveTask(task);
|
|
431
|
+
if (!resolvedTask) {
|
|
432
|
+
this._notificationService.error(( nls.localizeWithPath(
|
|
433
|
+
'vs/workbench/contrib/tasks/browser/taskQuickPick',
|
|
434
|
+
'noProviderForTask',
|
|
435
|
+
"There is no task provider registered for tasks of type \"{0}\".",
|
|
436
|
+
task.type
|
|
437
|
+
)));
|
|
438
|
+
}
|
|
439
|
+
return resolvedTask;
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
TaskQuickPick = TaskQuickPick_1 = ( __decorate([
|
|
443
|
+
( __param(0, ITaskService)),
|
|
444
|
+
( __param(1, IConfigurationService)),
|
|
445
|
+
( __param(2, IQuickInputService)),
|
|
446
|
+
( __param(3, INotificationService)),
|
|
447
|
+
( __param(4, IThemeService)),
|
|
448
|
+
( __param(5, IDialogService)),
|
|
449
|
+
( __param(6, IStorageService))
|
|
450
|
+
], TaskQuickPick));
|
|
451
|
+
|
|
452
|
+
export { QUICKOPEN_DETAIL_CONFIG, QUICKOPEN_SKIP_CONFIG, TaskQuickPick, configureTaskIcon, isWorkspaceFolder };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
2
|
+
import { ExecutionEngine } from 'vscode/vscode/vs/workbench/contrib/tasks/common/tasks';
|
|
3
|
+
import { AbstractTaskService } from './abstractTaskService.js';
|
|
4
|
+
|
|
5
|
+
class TaskService extends AbstractTaskService {
|
|
6
|
+
static { this.ProcessTaskSystemSupportMessage = ( nls.localizeWithPath(
|
|
7
|
+
'vs/workbench/contrib/tasks/browser/taskService',
|
|
8
|
+
'taskService.processTaskSystem',
|
|
9
|
+
'Process task system is not support in the web.'
|
|
10
|
+
)); }
|
|
11
|
+
_getTaskSystem() {
|
|
12
|
+
if (this._taskSystem) {
|
|
13
|
+
return this._taskSystem;
|
|
14
|
+
}
|
|
15
|
+
if (this.executionEngine !== ExecutionEngine.Terminal) {
|
|
16
|
+
throw new Error(TaskService.ProcessTaskSystemSupportMessage);
|
|
17
|
+
}
|
|
18
|
+
this._taskSystem = this._createTerminalTaskSystem();
|
|
19
|
+
this._taskSystemListeners =
|
|
20
|
+
[
|
|
21
|
+
this._taskSystem.onDidStateChange((event) => {
|
|
22
|
+
this._taskRunningState.set(this._taskSystem.isActiveSync());
|
|
23
|
+
this._onDidStateChange.fire(event);
|
|
24
|
+
}),
|
|
25
|
+
];
|
|
26
|
+
return this._taskSystem;
|
|
27
|
+
}
|
|
28
|
+
_computeLegacyConfiguration(workspaceFolder) {
|
|
29
|
+
throw new Error(TaskService.ProcessTaskSystemSupportMessage);
|
|
30
|
+
}
|
|
31
|
+
_versionAndEngineCompatible(filter) {
|
|
32
|
+
return this.executionEngine === ExecutionEngine.Terminal;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export { TaskService };
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import * as nls from 'monaco-editor/esm/vs/nls.js';
|
|
3
|
+
import { Codicon } from 'monaco-editor/esm/vs/base/common/codicons.js';
|
|
4
|
+
import { Disposable, toDisposable, MutableDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
import Severity from 'monaco-editor/esm/vs/base/common/severity.js';
|
|
6
|
+
import { StartStopProblemCollector } from '../common/problemCollectors.js';
|
|
7
|
+
import { ITaskService } from 'vscode/vscode/vs/workbench/contrib/tasks/common/taskService';
|
|
8
|
+
import { MarkerSeverity } from 'monaco-editor/esm/vs/platform/markers/common/markers.js';
|
|
9
|
+
import { spinningLoading } from 'monaco-editor/esm/vs/platform/theme/common/iconRegistry.js';
|
|
10
|
+
import { AudioCue, IAudioCueService } from 'monaco-editor/esm/vs/platform/audioCues/browser/audioCueService.js';
|
|
11
|
+
|
|
12
|
+
const TASK_TERMINAL_STATUS_ID = 'task_terminal_status';
|
|
13
|
+
const ACTIVE_TASK_STATUS = { id: TASK_TERMINAL_STATUS_ID, icon: spinningLoading, severity: Severity.Info, tooltip: ( nls.localizeWithPath(
|
|
14
|
+
'vs/workbench/contrib/tasks/browser/taskTerminalStatus',
|
|
15
|
+
'taskTerminalStatus.active',
|
|
16
|
+
"Task is running"
|
|
17
|
+
)) };
|
|
18
|
+
const SUCCEEDED_TASK_STATUS = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.check, severity: Severity.Info, tooltip: ( nls.localizeWithPath(
|
|
19
|
+
'vs/workbench/contrib/tasks/browser/taskTerminalStatus',
|
|
20
|
+
'taskTerminalStatus.succeeded',
|
|
21
|
+
"Task succeeded"
|
|
22
|
+
)) };
|
|
23
|
+
const SUCCEEDED_INACTIVE_TASK_STATUS = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.check, severity: Severity.Info, tooltip: ( nls.localizeWithPath(
|
|
24
|
+
'vs/workbench/contrib/tasks/browser/taskTerminalStatus',
|
|
25
|
+
'taskTerminalStatus.succeededInactive',
|
|
26
|
+
"Task succeeded and waiting..."
|
|
27
|
+
)) };
|
|
28
|
+
const FAILED_TASK_STATUS = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.error, severity: Severity.Error, tooltip: ( nls.localizeWithPath(
|
|
29
|
+
'vs/workbench/contrib/tasks/browser/taskTerminalStatus',
|
|
30
|
+
'taskTerminalStatus.errors',
|
|
31
|
+
"Task has errors"
|
|
32
|
+
)) };
|
|
33
|
+
const FAILED_INACTIVE_TASK_STATUS = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.error, severity: Severity.Error, tooltip: ( nls.localizeWithPath(
|
|
34
|
+
'vs/workbench/contrib/tasks/browser/taskTerminalStatus',
|
|
35
|
+
'taskTerminalStatus.errorsInactive',
|
|
36
|
+
"Task has errors and is waiting..."
|
|
37
|
+
)) };
|
|
38
|
+
const WARNING_TASK_STATUS = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.warning, severity: Severity.Warning, tooltip: ( nls.localizeWithPath(
|
|
39
|
+
'vs/workbench/contrib/tasks/browser/taskTerminalStatus',
|
|
40
|
+
'taskTerminalStatus.warnings',
|
|
41
|
+
"Task has warnings"
|
|
42
|
+
)) };
|
|
43
|
+
const WARNING_INACTIVE_TASK_STATUS = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.warning, severity: Severity.Warning, tooltip: ( nls.localizeWithPath(
|
|
44
|
+
'vs/workbench/contrib/tasks/browser/taskTerminalStatus',
|
|
45
|
+
'taskTerminalStatus.warningsInactive',
|
|
46
|
+
"Task has warnings and is waiting..."
|
|
47
|
+
)) };
|
|
48
|
+
const INFO_TASK_STATUS = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.info, severity: Severity.Info, tooltip: ( nls.localizeWithPath(
|
|
49
|
+
'vs/workbench/contrib/tasks/browser/taskTerminalStatus',
|
|
50
|
+
'taskTerminalStatus.infos',
|
|
51
|
+
"Task has infos"
|
|
52
|
+
)) };
|
|
53
|
+
const INFO_INACTIVE_TASK_STATUS = { id: TASK_TERMINAL_STATUS_ID, icon: Codicon.info, severity: Severity.Info, tooltip: ( nls.localizeWithPath(
|
|
54
|
+
'vs/workbench/contrib/tasks/browser/taskTerminalStatus',
|
|
55
|
+
'taskTerminalStatus.infosInactive',
|
|
56
|
+
"Task has infos and is waiting..."
|
|
57
|
+
)) };
|
|
58
|
+
let TaskTerminalStatus = class TaskTerminalStatus extends Disposable {
|
|
59
|
+
constructor(taskService, _audioCueService) {
|
|
60
|
+
super();
|
|
61
|
+
this._audioCueService = _audioCueService;
|
|
62
|
+
this.terminalMap = ( new Map());
|
|
63
|
+
this._register(taskService.onDidStateChange((event) => {
|
|
64
|
+
switch (event.kind) {
|
|
65
|
+
case "processStarted" :
|
|
66
|
+
case "active" :
|
|
67
|
+
this.eventActive(event);
|
|
68
|
+
break;
|
|
69
|
+
case "inactive" :
|
|
70
|
+
this.eventInactive(event);
|
|
71
|
+
break;
|
|
72
|
+
case "processEnded" :
|
|
73
|
+
this.eventEnd(event);
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
this._register(toDisposable(() => {
|
|
78
|
+
for (const terminalData of ( this.terminalMap.values())) {
|
|
79
|
+
terminalData.disposeListener?.dispose();
|
|
80
|
+
}
|
|
81
|
+
this.terminalMap.clear();
|
|
82
|
+
}));
|
|
83
|
+
}
|
|
84
|
+
addTerminal(task, terminal, problemMatcher) {
|
|
85
|
+
const status = { id: TASK_TERMINAL_STATUS_ID, severity: Severity.Info };
|
|
86
|
+
terminal.statusList.add(status);
|
|
87
|
+
this._register(problemMatcher.onDidFindFirstMatch(() => {
|
|
88
|
+
this._marker = terminal.registerMarker();
|
|
89
|
+
if (this._marker) {
|
|
90
|
+
this._register(this._marker);
|
|
91
|
+
}
|
|
92
|
+
}));
|
|
93
|
+
this._register(problemMatcher.onDidFindErrors(() => {
|
|
94
|
+
if (this._marker) {
|
|
95
|
+
terminal.addBufferMarker({ marker: this._marker, hoverMessage: ( nls.localizeWithPath(
|
|
96
|
+
'vs/workbench/contrib/tasks/browser/taskTerminalStatus',
|
|
97
|
+
'task.watchFirstError',
|
|
98
|
+
"Beginning of detected errors for this run"
|
|
99
|
+
)), disableCommandStorage: true });
|
|
100
|
+
}
|
|
101
|
+
}));
|
|
102
|
+
this._register(problemMatcher.onDidRequestInvalidateLastMarker(() => {
|
|
103
|
+
this._marker?.dispose();
|
|
104
|
+
this._marker = undefined;
|
|
105
|
+
}));
|
|
106
|
+
this.terminalMap.set(terminal.instanceId, { terminal, task, status, problemMatcher, taskRunEnded: false });
|
|
107
|
+
}
|
|
108
|
+
terminalFromEvent(event) {
|
|
109
|
+
if (!('terminalId' in event) || !event.terminalId) {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
return this.terminalMap.get(event.terminalId);
|
|
113
|
+
}
|
|
114
|
+
eventEnd(event) {
|
|
115
|
+
const terminalData = this.terminalFromEvent(event);
|
|
116
|
+
if (!terminalData) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
terminalData.taskRunEnded = true;
|
|
120
|
+
terminalData.terminal.statusList.remove(terminalData.status);
|
|
121
|
+
if ((event.exitCode === 0) && (terminalData.problemMatcher.numberOfMatches === 0)) {
|
|
122
|
+
this._audioCueService.playAudioCue(AudioCue.taskCompleted);
|
|
123
|
+
if (terminalData.task.configurationProperties.isBackground) {
|
|
124
|
+
for (const status of terminalData.terminal.statusList.statuses) {
|
|
125
|
+
terminalData.terminal.statusList.remove(status);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
terminalData.terminal.statusList.add(SUCCEEDED_TASK_STATUS);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
else if (event.exitCode || terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Error) {
|
|
133
|
+
this._audioCueService.playAudioCue(AudioCue.taskFailed);
|
|
134
|
+
terminalData.terminal.statusList.add(FAILED_TASK_STATUS);
|
|
135
|
+
}
|
|
136
|
+
else if (terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Warning) {
|
|
137
|
+
terminalData.terminal.statusList.add(WARNING_TASK_STATUS);
|
|
138
|
+
}
|
|
139
|
+
else if (terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Info) {
|
|
140
|
+
terminalData.terminal.statusList.add(INFO_TASK_STATUS);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
eventInactive(event) {
|
|
144
|
+
const terminalData = this.terminalFromEvent(event);
|
|
145
|
+
if (!terminalData || !terminalData.problemMatcher || terminalData.taskRunEnded) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
terminalData.terminal.statusList.remove(terminalData.status);
|
|
149
|
+
if (terminalData.problemMatcher.numberOfMatches === 0) {
|
|
150
|
+
this._audioCueService.playAudioCue(AudioCue.taskCompleted);
|
|
151
|
+
terminalData.terminal.statusList.add(SUCCEEDED_INACTIVE_TASK_STATUS);
|
|
152
|
+
}
|
|
153
|
+
else if (terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Error) {
|
|
154
|
+
this._audioCueService.playAudioCue(AudioCue.taskFailed);
|
|
155
|
+
terminalData.terminal.statusList.add(FAILED_INACTIVE_TASK_STATUS);
|
|
156
|
+
}
|
|
157
|
+
else if (terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Warning) {
|
|
158
|
+
terminalData.terminal.statusList.add(WARNING_INACTIVE_TASK_STATUS);
|
|
159
|
+
}
|
|
160
|
+
else if (terminalData.problemMatcher.maxMarkerSeverity === MarkerSeverity.Info) {
|
|
161
|
+
terminalData.terminal.statusList.add(INFO_INACTIVE_TASK_STATUS);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
eventActive(event) {
|
|
165
|
+
const terminalData = this.terminalFromEvent(event);
|
|
166
|
+
if (!terminalData) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (!terminalData.disposeListener) {
|
|
170
|
+
terminalData.disposeListener = this._register(( new MutableDisposable()));
|
|
171
|
+
terminalData.disposeListener.value = terminalData.terminal.onDisposed(() => {
|
|
172
|
+
if (!event.terminalId) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
this.terminalMap.delete(event.terminalId);
|
|
176
|
+
terminalData.disposeListener?.dispose();
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
terminalData.taskRunEnded = false;
|
|
180
|
+
terminalData.terminal.statusList.remove(terminalData.status);
|
|
181
|
+
if ((terminalData.problemMatcher instanceof StartStopProblemCollector) || (terminalData.problemMatcher?.problemMatchers.length > 0) || event.runType === "singleRun" ) {
|
|
182
|
+
terminalData.terminal.statusList.add(ACTIVE_TASK_STATUS);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
TaskTerminalStatus = ( __decorate([
|
|
187
|
+
( __param(0, ITaskService)),
|
|
188
|
+
( __param(1, IAudioCueService))
|
|
189
|
+
], TaskTerminalStatus));
|
|
190
|
+
|
|
191
|
+
export { ACTIVE_TASK_STATUS, FAILED_TASK_STATUS, SUCCEEDED_TASK_STATUS, TaskTerminalStatus };
|