@theia/task 1.45.0 → 1.46.0-next.72
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/README.md +193 -193
- package/lib/browser/index.d.ts +6 -6
- package/lib/browser/index.js +33 -33
- package/lib/browser/process/process-task-contribution.d.ts +6 -6
- package/lib/browser/process/process-task-contribution.js +43 -43
- package/lib/browser/process/process-task-frontend-module.d.ts +2 -2
- package/lib/browser/process/process-task-frontend-module.js +27 -27
- package/lib/browser/process/process-task-resolver.d.ts +17 -17
- package/lib/browser/process/process-task-resolver.js +101 -101
- package/lib/browser/provided-task-configurations.d.ts +43 -43
- package/lib/browser/provided-task-configurations.js +213 -213
- package/lib/browser/provided-task-configurations.spec.d.ts +1 -1
- package/lib/browser/provided-task-configurations.spec.js +43 -43
- package/lib/browser/quick-open-task.d.ts +144 -144
- package/lib/browser/quick-open-task.d.ts.map +1 -1
- package/lib/browser/quick-open-task.js +752 -748
- package/lib/browser/quick-open-task.js.map +1 -1
- package/lib/browser/task-configuration-manager.d.ts +64 -64
- package/lib/browser/task-configuration-manager.js +261 -261
- package/lib/browser/task-configuration-model.d.ts +32 -32
- package/lib/browser/task-configuration-model.js +79 -79
- package/lib/browser/task-configurations.d.ts +127 -127
- package/lib/browser/task-configurations.js +486 -486
- package/lib/browser/task-contribution.d.ts +182 -182
- package/lib/browser/task-contribution.js +206 -206
- package/lib/browser/task-definition-registry.d.ts +38 -38
- package/lib/browser/task-definition-registry.js +134 -134
- package/lib/browser/task-definition-registry.spec.d.ts +1 -1
- package/lib/browser/task-definition-registry.spec.js +170 -170
- package/lib/browser/task-frontend-contribution.d.ts +56 -56
- package/lib/browser/task-frontend-contribution.js +358 -358
- package/lib/browser/task-frontend-module.d.ts +5 -5
- package/lib/browser/task-frontend-module.js +79 -79
- package/lib/browser/task-name-resolver.d.ts +13 -13
- package/lib/browser/task-name-resolver.js +67 -67
- package/lib/browser/task-node.d.ts +9 -9
- package/lib/browser/task-node.js +17 -17
- package/lib/browser/task-preferences.d.ts +4 -4
- package/lib/browser/task-preferences.js +40 -40
- package/lib/browser/task-problem-matcher-registry.d.ts +40 -40
- package/lib/browser/task-problem-matcher-registry.js +309 -309
- package/lib/browser/task-problem-pattern-registry.d.ts +23 -23
- package/lib/browser/task-problem-pattern-registry.js +210 -210
- package/lib/browser/task-schema-updater.d.ts +58 -58
- package/lib/browser/task-schema-updater.js +688 -688
- package/lib/browser/task-service.d.ts +279 -279
- package/lib/browser/task-service.js +1119 -1119
- package/lib/browser/task-source-resolver.d.ts +9 -9
- package/lib/browser/task-source-resolver.js +51 -51
- package/lib/browser/task-templates.d.ts +13 -13
- package/lib/browser/task-templates.js +161 -161
- package/lib/browser/task-terminal-widget-manager.d.ts +44 -44
- package/lib/browser/task-terminal-widget-manager.js +228 -228
- package/lib/browser/tasks-monaco-contribution.d.ts +1 -1
- package/lib/browser/tasks-monaco-contribution.js +27 -27
- package/lib/common/index.d.ts +4 -4
- package/lib/common/index.js +31 -31
- package/lib/common/problem-matcher-protocol.d.ts +124 -124
- package/lib/common/problem-matcher-protocol.js +132 -132
- package/lib/common/process/task-protocol.d.ts +68 -68
- package/lib/common/process/task-protocol.js +33 -33
- package/lib/common/task-common-module.d.ts +7 -7
- package/lib/common/task-common-module.js +33 -33
- package/lib/common/task-protocol.d.ts +192 -192
- package/lib/common/task-protocol.js +137 -137
- package/lib/common/task-util.d.ts +22 -22
- package/lib/common/task-util.js +46 -46
- package/lib/common/task-watcher.d.ts +17 -17
- package/lib/common/task-watcher.js +86 -86
- package/lib/node/custom/custom-task-runner-backend-module.d.ts +2 -2
- package/lib/node/custom/custom-task-runner-backend-module.js +36 -36
- package/lib/node/custom/custom-task-runner-contribution.d.ts +6 -6
- package/lib/node/custom/custom-task-runner-contribution.js +42 -42
- package/lib/node/custom/custom-task-runner.d.ts +15 -15
- package/lib/node/custom/custom-task-runner.js +69 -69
- package/lib/node/custom/custom-task.d.ts +20 -20
- package/lib/node/custom/custom-task.js +78 -78
- package/lib/node/index.d.ts +3 -3
- package/lib/node/index.js +30 -30
- package/lib/node/process/process-task-runner-backend-module.d.ts +2 -2
- package/lib/node/process/process-task-runner-backend-module.js +36 -36
- package/lib/node/process/process-task-runner-contribution.d.ts +6 -6
- package/lib/node/process/process-task-runner-contribution.js +43 -43
- package/lib/node/process/process-task-runner.d.ts +60 -60
- package/lib/node/process/process-task-runner.js +355 -355
- package/lib/node/process/process-task.d.ts +26 -26
- package/lib/node/process/process-task.js +135 -135
- package/lib/node/process/process-task.spec.d.ts +1 -1
- package/lib/node/process/process-task.spec.js +29 -29
- package/lib/node/task-abstract-line-matcher.d.ts +49 -49
- package/lib/node/task-abstract-line-matcher.js +273 -273
- package/lib/node/task-backend-application-contribution.d.ts +8 -8
- package/lib/node/task-backend-application-contribution.js +48 -48
- package/lib/node/task-backend-module.d.ts +3 -3
- package/lib/node/task-backend-module.js +50 -50
- package/lib/node/task-line-matchers.d.ts +27 -27
- package/lib/node/task-line-matchers.js +121 -121
- package/lib/node/task-manager.d.ts +55 -55
- package/lib/node/task-manager.js +135 -135
- package/lib/node/task-problem-collector.d.ts +10 -10
- package/lib/node/task-problem-collector.js +57 -57
- package/lib/node/task-problem-collector.spec.d.ts +1 -1
- package/lib/node/task-problem-collector.spec.js +310 -310
- package/lib/node/task-runner-protocol.d.ts +16 -16
- package/lib/node/task-runner-protocol.js +19 -19
- package/lib/node/task-runner.d.ts +50 -50
- package/lib/node/task-runner.js +97 -97
- package/lib/node/task-server.d.ts +39 -39
- package/lib/node/task-server.js +237 -237
- package/lib/node/task-server.slow-spec.d.ts +1 -1
- package/lib/node/task-server.slow-spec.js +395 -395
- package/lib/node/task.d.ts +50 -50
- package/lib/node/task.js +77 -77
- package/lib/node/test/task-test-container.d.ts +2 -2
- package/lib/node/test/task-test-container.js +58 -58
- package/package.json +14 -14
- package/src/browser/index.ts +22 -22
- package/src/browser/process/process-task-contribution.ts +31 -31
- package/src/browser/process/process-task-frontend-module.ts +27 -27
- package/src/browser/process/process-task-resolver.ts +89 -89
- package/src/browser/provided-task-configurations.spec.ts +46 -46
- package/src/browser/provided-task-configurations.ts +213 -213
- package/src/browser/quick-open-task.ts +831 -827
- package/src/browser/style/index.css +19 -19
- package/src/browser/task-configuration-manager.ts +256 -256
- package/src/browser/task-configuration-model.ts +101 -101
- package/src/browser/task-configurations.ts +508 -508
- package/src/browser/task-contribution.ts +266 -266
- package/src/browser/task-definition-registry.spec.ts +203 -203
- package/src/browser/task-definition-registry.ts +131 -131
- package/src/browser/task-frontend-contribution.ts +402 -402
- package/src/browser/task-frontend-module.ts +86 -86
- package/src/browser/task-name-resolver.ts +55 -55
- package/src/browser/task-node.ts +37 -37
- package/src/browser/task-preferences.ts +40 -40
- package/src/browser/task-problem-matcher-registry.ts +308 -308
- package/src/browser/task-problem-pattern-registry.ts +196 -196
- package/src/browser/task-schema-updater.ts +701 -701
- package/src/browser/task-service.ts +1164 -1164
- package/src/browser/task-source-resolver.ts +36 -36
- package/src/browser/task-templates.ts +168 -168
- package/src/browser/task-terminal-widget-manager.ts +224 -224
- package/src/browser/tasks-monaco-contribution.ts +27 -27
- package/src/common/index.ts +20 -20
- package/src/common/problem-matcher-protocol.ts +234 -234
- package/src/common/process/task-protocol.ts +97 -97
- package/src/common/task-common-module.ts +34 -34
- package/src/common/task-protocol.ts +317 -317
- package/src/common/task-util.ts +43 -43
- package/src/common/task-watcher.ts +78 -78
- package/src/node/custom/custom-task-runner-backend-module.ts +37 -37
- package/src/node/custom/custom-task-runner-contribution.ts +30 -30
- package/src/node/custom/custom-task-runner.ts +60 -60
- package/src/node/custom/custom-task.ts +73 -73
- package/src/node/index.ts +19 -19
- package/src/node/process/process-task-runner-backend-module.ts +37 -37
- package/src/node/process/process-task-runner-contribution.ts +31 -31
- package/src/node/process/process-task-runner.ts +371 -371
- package/src/node/process/process-task.spec.ts +30 -30
- package/src/node/process/process-task.ts +144 -144
- package/src/node/task-abstract-line-matcher.ts +312 -312
- package/src/node/task-backend-application-contribution.ts +36 -36
- package/src/node/task-backend-module.ts +57 -57
- package/src/node/task-line-matchers.ts +127 -127
- package/src/node/task-manager.ts +129 -129
- package/src/node/task-problem-collector.spec.ts +338 -338
- package/src/node/task-problem-collector.ts +62 -62
- package/src/node/task-runner-protocol.ts +33 -33
- package/src/node/task-runner.ts +96 -96
- package/src/node/task-server.slow-spec.ts +444 -444
- package/src/node/task-server.ts +263 -263
- package/src/node/task.ts +103 -103
- package/src/node/test/task-test-container.ts +63 -63
|
@@ -1,402 +1,402 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2017 Ericsson and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ILogger, ContributionProvider, CommandContribution, Command, CommandRegistry, MenuContribution, MenuModelRegistry, nls } from '@theia/core/lib/common';
|
|
19
|
-
import { QuickOpenTask, TaskTerminateQuickOpen, TaskRunningQuickOpen, TaskRestartRunningQuickOpen } from './quick-open-task';
|
|
20
|
-
import {
|
|
21
|
-
FrontendApplication, FrontendApplicationContribution, QuickAccessContribution,
|
|
22
|
-
KeybindingRegistry, KeybindingContribution, StorageService, StatusBar, StatusBarAlignment, CommonMenus
|
|
23
|
-
} from '@theia/core/lib/browser';
|
|
24
|
-
import { WidgetManager } from '@theia/core/lib/browser/widget-manager';
|
|
25
|
-
import { TaskContribution, TaskResolverRegistry, TaskProviderRegistry } from './task-contribution';
|
|
26
|
-
import { TaskService } from './task-service';
|
|
27
|
-
import { TerminalMenus } from '@theia/terminal/lib/browser/terminal-frontend-contribution';
|
|
28
|
-
import { TaskSchemaUpdater } from './task-schema-updater';
|
|
29
|
-
import { TaskConfiguration, TaskWatcher } from '../common';
|
|
30
|
-
import { EditorManager } from '@theia/editor/lib/browser';
|
|
31
|
-
import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
|
|
32
|
-
|
|
33
|
-
export namespace TaskCommands {
|
|
34
|
-
const TASK_CATEGORY = 'Task';
|
|
35
|
-
const TASK_CATEGORY_KEY = nls.getDefaultKey(TASK_CATEGORY);
|
|
36
|
-
export const TASK_RUN = Command.toDefaultLocalizedCommand({
|
|
37
|
-
id: 'task:run',
|
|
38
|
-
category: TASK_CATEGORY,
|
|
39
|
-
label: 'Run Task...'
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export const TASK_RUN_BUILD = Command.toDefaultLocalizedCommand({
|
|
43
|
-
id: 'task:run:build',
|
|
44
|
-
category: TASK_CATEGORY,
|
|
45
|
-
label: 'Run Build Task'
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
export const TASK_RUN_TEST = Command.toDefaultLocalizedCommand({
|
|
49
|
-
id: 'task:run:test',
|
|
50
|
-
category: TASK_CATEGORY,
|
|
51
|
-
label: 'Run Test Task'
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
export const WORKBENCH_RUN_TASK = Command.toLocalizedCommand({
|
|
55
|
-
id: 'workbench.action.tasks.runTask',
|
|
56
|
-
category: TASK_CATEGORY
|
|
57
|
-
}, '', TASK_CATEGORY_KEY);
|
|
58
|
-
|
|
59
|
-
export const TASK_RUN_LAST = Command.toDefaultLocalizedCommand({
|
|
60
|
-
id: 'task:run:last',
|
|
61
|
-
category: TASK_CATEGORY,
|
|
62
|
-
label: 'Rerun Last Task'
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
export const TASK_ATTACH = Command.toLocalizedCommand({
|
|
66
|
-
id: 'task:attach',
|
|
67
|
-
category: TASK_CATEGORY,
|
|
68
|
-
label: 'Attach Task...'
|
|
69
|
-
}, 'theia/task/attachTask', TASK_CATEGORY_KEY);
|
|
70
|
-
|
|
71
|
-
export const TASK_RUN_TEXT = Command.toDefaultLocalizedCommand({
|
|
72
|
-
id: 'task:run:text',
|
|
73
|
-
category: TASK_CATEGORY,
|
|
74
|
-
label: 'Run Selected Text'
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
export const TASK_CONFIGURE = Command.toDefaultLocalizedCommand({
|
|
78
|
-
id: 'task:configure',
|
|
79
|
-
category: TASK_CATEGORY,
|
|
80
|
-
label: 'Configure Tasks...'
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
export const TASK_OPEN_USER = Command.toLocalizedCommand({
|
|
84
|
-
id: 'task:open_user',
|
|
85
|
-
category: TASK_CATEGORY,
|
|
86
|
-
label: 'Open User Tasks'
|
|
87
|
-
}, 'theia/task/openUserTasks', TASK_CATEGORY_KEY);
|
|
88
|
-
|
|
89
|
-
export const TASK_CLEAR_HISTORY = Command.toLocalizedCommand({
|
|
90
|
-
id: 'task:clear-history',
|
|
91
|
-
category: TASK_CATEGORY,
|
|
92
|
-
label: 'Clear History'
|
|
93
|
-
}, 'theia/task/clearHistory', TASK_CATEGORY_KEY);
|
|
94
|
-
|
|
95
|
-
export const TASK_SHOW_RUNNING = Command.toDefaultLocalizedCommand({
|
|
96
|
-
id: 'task:show-running',
|
|
97
|
-
category: TASK_CATEGORY,
|
|
98
|
-
label: 'Show Running Tasks'
|
|
99
|
-
});
|
|
100
|
-
|
|
101
|
-
export const TASK_TERMINATE = Command.toDefaultLocalizedCommand({
|
|
102
|
-
id: 'task:terminate',
|
|
103
|
-
category: TASK_CATEGORY,
|
|
104
|
-
label: 'Terminate Task'
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
export const TASK_RESTART_RUNNING = Command.toDefaultLocalizedCommand({
|
|
108
|
-
id: 'task:restart-running',
|
|
109
|
-
category: TASK_CATEGORY,
|
|
110
|
-
label: 'Restart Running Task...'
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const TASKS_STORAGE_KEY = 'tasks';
|
|
115
|
-
|
|
116
|
-
@injectable()
|
|
117
|
-
export class TaskFrontendContribution implements CommandContribution, MenuContribution, KeybindingContribution, FrontendApplicationContribution, QuickAccessContribution {
|
|
118
|
-
@inject(QuickOpenTask)
|
|
119
|
-
protected readonly quickOpenTask: QuickOpenTask;
|
|
120
|
-
|
|
121
|
-
@inject(EditorManager)
|
|
122
|
-
protected readonly editorManager: EditorManager;
|
|
123
|
-
|
|
124
|
-
@inject(FrontendApplication)
|
|
125
|
-
protected readonly app: FrontendApplication;
|
|
126
|
-
|
|
127
|
-
@inject(ILogger) @named('task')
|
|
128
|
-
protected readonly logger: ILogger;
|
|
129
|
-
|
|
130
|
-
@inject(WidgetManager)
|
|
131
|
-
protected readonly widgetManager: WidgetManager;
|
|
132
|
-
|
|
133
|
-
@inject(ContributionProvider) @named(TaskContribution)
|
|
134
|
-
protected readonly contributionProvider: ContributionProvider<TaskContribution>;
|
|
135
|
-
|
|
136
|
-
@inject(TaskProviderRegistry)
|
|
137
|
-
protected readonly taskProviderRegistry: TaskProviderRegistry;
|
|
138
|
-
|
|
139
|
-
@inject(TaskResolverRegistry)
|
|
140
|
-
protected readonly taskResolverRegistry: TaskResolverRegistry;
|
|
141
|
-
|
|
142
|
-
@inject(TaskService)
|
|
143
|
-
protected readonly taskService: TaskService;
|
|
144
|
-
|
|
145
|
-
@inject(TaskSchemaUpdater)
|
|
146
|
-
protected readonly schemaUpdater: TaskSchemaUpdater;
|
|
147
|
-
|
|
148
|
-
@inject(StorageService)
|
|
149
|
-
protected readonly storageService: StorageService;
|
|
150
|
-
|
|
151
|
-
@inject(TaskRunningQuickOpen)
|
|
152
|
-
protected readonly taskRunningQuickOpen: TaskRunningQuickOpen;
|
|
153
|
-
|
|
154
|
-
@inject(TaskTerminateQuickOpen)
|
|
155
|
-
protected readonly taskTerminateQuickOpen: TaskTerminateQuickOpen;
|
|
156
|
-
|
|
157
|
-
@inject(TaskRestartRunningQuickOpen)
|
|
158
|
-
protected readonly taskRestartRunningQuickOpen: TaskRestartRunningQuickOpen;
|
|
159
|
-
|
|
160
|
-
@inject(TaskWatcher)
|
|
161
|
-
protected readonly taskWatcher: TaskWatcher;
|
|
162
|
-
|
|
163
|
-
@inject(StatusBar)
|
|
164
|
-
protected readonly statusBar: StatusBar;
|
|
165
|
-
|
|
166
|
-
@inject(WorkspaceService)
|
|
167
|
-
protected readonly workspaceService: WorkspaceService;
|
|
168
|
-
|
|
169
|
-
@postConstruct()
|
|
170
|
-
protected init(): void {
|
|
171
|
-
this.taskWatcher.onTaskCreated(() => this.updateRunningTasksItem());
|
|
172
|
-
this.taskWatcher.onTaskExit(() => this.updateRunningTasksItem());
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
onStart(): void {
|
|
176
|
-
this.contributionProvider.getContributions().forEach(contrib => {
|
|
177
|
-
if (contrib.registerResolvers) {
|
|
178
|
-
contrib.registerResolvers(this.taskResolverRegistry);
|
|
179
|
-
}
|
|
180
|
-
if (contrib.registerProviders) {
|
|
181
|
-
contrib.registerProviders(this.taskProviderRegistry);
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
this.schemaUpdater.update();
|
|
185
|
-
|
|
186
|
-
this.storageService.getData<{ recent: TaskConfiguration[] }>(TASKS_STORAGE_KEY, { recent: [] })
|
|
187
|
-
.then(tasks => this.taskService.recentTasks = tasks.recent);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
onStop(): void {
|
|
191
|
-
const recent = this.taskService.recentTasks;
|
|
192
|
-
this.storageService.setData<{ recent: TaskConfiguration[] }>(TASKS_STORAGE_KEY, { recent });
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Contribute a status-bar item to trigger
|
|
197
|
-
* the `Show Running Tasks` command.
|
|
198
|
-
*/
|
|
199
|
-
protected async updateRunningTasksItem(): Promise<void> {
|
|
200
|
-
const id = 'show-running-tasks';
|
|
201
|
-
const items = await this.taskService.getRunningTasks();
|
|
202
|
-
if (!!items.length) {
|
|
203
|
-
this.statusBar.setElement(id, {
|
|
204
|
-
text: `$(tools) ${items.length}`,
|
|
205
|
-
tooltip: TaskCommands.TASK_SHOW_RUNNING.label,
|
|
206
|
-
alignment: StatusBarAlignment.LEFT,
|
|
207
|
-
priority: 2,
|
|
208
|
-
command: TaskCommands.TASK_SHOW_RUNNING.id,
|
|
209
|
-
});
|
|
210
|
-
} else {
|
|
211
|
-
this.statusBar.removeElement(id);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
registerCommands(registry: CommandRegistry): void {
|
|
216
|
-
registry.registerCommand(
|
|
217
|
-
TaskCommands.WORKBENCH_RUN_TASK,
|
|
218
|
-
{
|
|
219
|
-
isEnabled: () => true,
|
|
220
|
-
execute: async (label: string) => {
|
|
221
|
-
const didExecute = await this.taskService.runTaskByLabel(this.taskService.startUserAction(), label);
|
|
222
|
-
if (!didExecute) {
|
|
223
|
-
this.quickOpenTask.open();
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
);
|
|
228
|
-
|
|
229
|
-
registry.registerCommand(
|
|
230
|
-
TaskCommands.TASK_RUN,
|
|
231
|
-
{
|
|
232
|
-
isEnabled: () => true,
|
|
233
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
234
|
-
execute: (...args: any[]) => {
|
|
235
|
-
const [source, label, scope] = args;
|
|
236
|
-
if (source && label) {
|
|
237
|
-
return this.taskService.run(this.taskService.startUserAction(), source, label, scope);
|
|
238
|
-
}
|
|
239
|
-
return this.quickOpenTask.open();
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
);
|
|
243
|
-
registry.registerCommand(
|
|
244
|
-
TaskCommands.TASK_RUN_BUILD,
|
|
245
|
-
{
|
|
246
|
-
isEnabled: () => this.workspaceService.opened,
|
|
247
|
-
execute: () =>
|
|
248
|
-
this.quickOpenTask.runBuildOrTestTask('build')
|
|
249
|
-
}
|
|
250
|
-
);
|
|
251
|
-
registry.registerCommand(
|
|
252
|
-
TaskCommands.TASK_RUN_TEST,
|
|
253
|
-
{
|
|
254
|
-
isEnabled: () => this.workspaceService.opened,
|
|
255
|
-
execute: () =>
|
|
256
|
-
this.quickOpenTask.runBuildOrTestTask('test')
|
|
257
|
-
}
|
|
258
|
-
);
|
|
259
|
-
registry.registerCommand(
|
|
260
|
-
TaskCommands.TASK_ATTACH,
|
|
261
|
-
{
|
|
262
|
-
isEnabled: () => true,
|
|
263
|
-
execute: () => this.quickOpenTask.attach()
|
|
264
|
-
}
|
|
265
|
-
);
|
|
266
|
-
registry.registerCommand(
|
|
267
|
-
TaskCommands.TASK_RUN_LAST,
|
|
268
|
-
{
|
|
269
|
-
execute: async () => {
|
|
270
|
-
if (!await this.taskService.runLastTask(this.taskService.startUserAction())) {
|
|
271
|
-
await this.quickOpenTask.open();
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
);
|
|
276
|
-
registry.registerCommand(
|
|
277
|
-
TaskCommands.TASK_RUN_TEXT,
|
|
278
|
-
{
|
|
279
|
-
isVisible: () => !!this.editorManager.currentEditor,
|
|
280
|
-
isEnabled: () => !!this.editorManager.currentEditor,
|
|
281
|
-
execute: () => this.taskService.runSelectedText()
|
|
282
|
-
}
|
|
283
|
-
);
|
|
284
|
-
|
|
285
|
-
registry.registerCommand(
|
|
286
|
-
TaskCommands.TASK_CONFIGURE,
|
|
287
|
-
{
|
|
288
|
-
execute: () => this.quickOpenTask.configure()
|
|
289
|
-
}
|
|
290
|
-
);
|
|
291
|
-
|
|
292
|
-
registry.registerCommand(
|
|
293
|
-
TaskCommands.TASK_OPEN_USER,
|
|
294
|
-
{
|
|
295
|
-
execute: () => {
|
|
296
|
-
this.taskService.openUserTasks();
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
);
|
|
300
|
-
|
|
301
|
-
registry.registerCommand(
|
|
302
|
-
TaskCommands.TASK_CLEAR_HISTORY,
|
|
303
|
-
{
|
|
304
|
-
execute: () => this.taskService.clearRecentTasks()
|
|
305
|
-
}
|
|
306
|
-
);
|
|
307
|
-
|
|
308
|
-
registry.registerCommand(
|
|
309
|
-
TaskCommands.TASK_SHOW_RUNNING,
|
|
310
|
-
{
|
|
311
|
-
execute: () => this.taskRunningQuickOpen.open()
|
|
312
|
-
}
|
|
313
|
-
);
|
|
314
|
-
|
|
315
|
-
registry.registerCommand(
|
|
316
|
-
TaskCommands.TASK_TERMINATE,
|
|
317
|
-
{
|
|
318
|
-
execute: () => this.taskTerminateQuickOpen.open()
|
|
319
|
-
}
|
|
320
|
-
);
|
|
321
|
-
|
|
322
|
-
registry.registerCommand(
|
|
323
|
-
TaskCommands.TASK_RESTART_RUNNING,
|
|
324
|
-
{
|
|
325
|
-
execute: () => this.taskRestartRunningQuickOpen.open()
|
|
326
|
-
}
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
registerMenus(menus: MenuModelRegistry): void {
|
|
331
|
-
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS, {
|
|
332
|
-
commandId: TaskCommands.TASK_RUN.id,
|
|
333
|
-
order: '0'
|
|
334
|
-
});
|
|
335
|
-
|
|
336
|
-
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS, {
|
|
337
|
-
commandId: TaskCommands.TASK_RUN_BUILD.id,
|
|
338
|
-
order: '1'
|
|
339
|
-
});
|
|
340
|
-
|
|
341
|
-
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS, {
|
|
342
|
-
commandId: TaskCommands.TASK_RUN_TEST.id,
|
|
343
|
-
order: '2'
|
|
344
|
-
});
|
|
345
|
-
|
|
346
|
-
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS, {
|
|
347
|
-
commandId: TaskCommands.TASK_RUN_LAST.id,
|
|
348
|
-
order: '3'
|
|
349
|
-
});
|
|
350
|
-
|
|
351
|
-
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS, {
|
|
352
|
-
commandId: TaskCommands.TASK_ATTACH.id,
|
|
353
|
-
order: '4'
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS, {
|
|
357
|
-
commandId: TaskCommands.TASK_RUN_TEXT.id,
|
|
358
|
-
order: '5'
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS_INFO, {
|
|
362
|
-
commandId: TaskCommands.TASK_SHOW_RUNNING.id,
|
|
363
|
-
label: TaskCommands.TASK_SHOW_RUNNING.label + '...',
|
|
364
|
-
order: '0'
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS_INFO, {
|
|
368
|
-
commandId: TaskCommands.TASK_RESTART_RUNNING.id,
|
|
369
|
-
label: TaskCommands.TASK_RESTART_RUNNING.label,
|
|
370
|
-
order: '1'
|
|
371
|
-
});
|
|
372
|
-
|
|
373
|
-
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS_INFO, {
|
|
374
|
-
commandId: TaskCommands.TASK_TERMINATE.id,
|
|
375
|
-
label: TaskCommands.TASK_TERMINATE.label + '...',
|
|
376
|
-
order: '2'
|
|
377
|
-
});
|
|
378
|
-
|
|
379
|
-
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS_CONFIG, {
|
|
380
|
-
commandId: TaskCommands.TASK_CONFIGURE.id,
|
|
381
|
-
order: '0'
|
|
382
|
-
});
|
|
383
|
-
|
|
384
|
-
menus.registerMenuAction(CommonMenus.MANAGE_SETTINGS, {
|
|
385
|
-
commandId: TaskCommands.TASK_OPEN_USER.id,
|
|
386
|
-
label: nls.localizeByDefault('User Tasks'),
|
|
387
|
-
order: 'a40'
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
registerQuickAccessProvider(): void {
|
|
392
|
-
this.quickOpenTask.registerQuickAccessProvider();
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
registerKeybindings(keybindings: KeybindingRegistry): void {
|
|
396
|
-
keybindings.registerKeybinding({
|
|
397
|
-
command: TaskCommands.TASK_RUN_LAST.id,
|
|
398
|
-
keybinding: 'ctrlcmd+shift+k',
|
|
399
|
-
when: '!textInputFocus || editorReadonly'
|
|
400
|
-
});
|
|
401
|
-
}
|
|
402
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2017 Ericsson and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { inject, injectable, named, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
+
import { ILogger, ContributionProvider, CommandContribution, Command, CommandRegistry, MenuContribution, MenuModelRegistry, nls } from '@theia/core/lib/common';
|
|
19
|
+
import { QuickOpenTask, TaskTerminateQuickOpen, TaskRunningQuickOpen, TaskRestartRunningQuickOpen } from './quick-open-task';
|
|
20
|
+
import {
|
|
21
|
+
FrontendApplication, FrontendApplicationContribution, QuickAccessContribution,
|
|
22
|
+
KeybindingRegistry, KeybindingContribution, StorageService, StatusBar, StatusBarAlignment, CommonMenus
|
|
23
|
+
} from '@theia/core/lib/browser';
|
|
24
|
+
import { WidgetManager } from '@theia/core/lib/browser/widget-manager';
|
|
25
|
+
import { TaskContribution, TaskResolverRegistry, TaskProviderRegistry } from './task-contribution';
|
|
26
|
+
import { TaskService } from './task-service';
|
|
27
|
+
import { TerminalMenus } from '@theia/terminal/lib/browser/terminal-frontend-contribution';
|
|
28
|
+
import { TaskSchemaUpdater } from './task-schema-updater';
|
|
29
|
+
import { TaskConfiguration, TaskWatcher } from '../common';
|
|
30
|
+
import { EditorManager } from '@theia/editor/lib/browser';
|
|
31
|
+
import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
|
|
32
|
+
|
|
33
|
+
export namespace TaskCommands {
|
|
34
|
+
const TASK_CATEGORY = 'Task';
|
|
35
|
+
const TASK_CATEGORY_KEY = nls.getDefaultKey(TASK_CATEGORY);
|
|
36
|
+
export const TASK_RUN = Command.toDefaultLocalizedCommand({
|
|
37
|
+
id: 'task:run',
|
|
38
|
+
category: TASK_CATEGORY,
|
|
39
|
+
label: 'Run Task...'
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const TASK_RUN_BUILD = Command.toDefaultLocalizedCommand({
|
|
43
|
+
id: 'task:run:build',
|
|
44
|
+
category: TASK_CATEGORY,
|
|
45
|
+
label: 'Run Build Task'
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const TASK_RUN_TEST = Command.toDefaultLocalizedCommand({
|
|
49
|
+
id: 'task:run:test',
|
|
50
|
+
category: TASK_CATEGORY,
|
|
51
|
+
label: 'Run Test Task'
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const WORKBENCH_RUN_TASK = Command.toLocalizedCommand({
|
|
55
|
+
id: 'workbench.action.tasks.runTask',
|
|
56
|
+
category: TASK_CATEGORY
|
|
57
|
+
}, '', TASK_CATEGORY_KEY);
|
|
58
|
+
|
|
59
|
+
export const TASK_RUN_LAST = Command.toDefaultLocalizedCommand({
|
|
60
|
+
id: 'task:run:last',
|
|
61
|
+
category: TASK_CATEGORY,
|
|
62
|
+
label: 'Rerun Last Task'
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
export const TASK_ATTACH = Command.toLocalizedCommand({
|
|
66
|
+
id: 'task:attach',
|
|
67
|
+
category: TASK_CATEGORY,
|
|
68
|
+
label: 'Attach Task...'
|
|
69
|
+
}, 'theia/task/attachTask', TASK_CATEGORY_KEY);
|
|
70
|
+
|
|
71
|
+
export const TASK_RUN_TEXT = Command.toDefaultLocalizedCommand({
|
|
72
|
+
id: 'task:run:text',
|
|
73
|
+
category: TASK_CATEGORY,
|
|
74
|
+
label: 'Run Selected Text'
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export const TASK_CONFIGURE = Command.toDefaultLocalizedCommand({
|
|
78
|
+
id: 'task:configure',
|
|
79
|
+
category: TASK_CATEGORY,
|
|
80
|
+
label: 'Configure Tasks...'
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export const TASK_OPEN_USER = Command.toLocalizedCommand({
|
|
84
|
+
id: 'task:open_user',
|
|
85
|
+
category: TASK_CATEGORY,
|
|
86
|
+
label: 'Open User Tasks'
|
|
87
|
+
}, 'theia/task/openUserTasks', TASK_CATEGORY_KEY);
|
|
88
|
+
|
|
89
|
+
export const TASK_CLEAR_HISTORY = Command.toLocalizedCommand({
|
|
90
|
+
id: 'task:clear-history',
|
|
91
|
+
category: TASK_CATEGORY,
|
|
92
|
+
label: 'Clear History'
|
|
93
|
+
}, 'theia/task/clearHistory', TASK_CATEGORY_KEY);
|
|
94
|
+
|
|
95
|
+
export const TASK_SHOW_RUNNING = Command.toDefaultLocalizedCommand({
|
|
96
|
+
id: 'task:show-running',
|
|
97
|
+
category: TASK_CATEGORY,
|
|
98
|
+
label: 'Show Running Tasks'
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
export const TASK_TERMINATE = Command.toDefaultLocalizedCommand({
|
|
102
|
+
id: 'task:terminate',
|
|
103
|
+
category: TASK_CATEGORY,
|
|
104
|
+
label: 'Terminate Task'
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
export const TASK_RESTART_RUNNING = Command.toDefaultLocalizedCommand({
|
|
108
|
+
id: 'task:restart-running',
|
|
109
|
+
category: TASK_CATEGORY,
|
|
110
|
+
label: 'Restart Running Task...'
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const TASKS_STORAGE_KEY = 'tasks';
|
|
115
|
+
|
|
116
|
+
@injectable()
|
|
117
|
+
export class TaskFrontendContribution implements CommandContribution, MenuContribution, KeybindingContribution, FrontendApplicationContribution, QuickAccessContribution {
|
|
118
|
+
@inject(QuickOpenTask)
|
|
119
|
+
protected readonly quickOpenTask: QuickOpenTask;
|
|
120
|
+
|
|
121
|
+
@inject(EditorManager)
|
|
122
|
+
protected readonly editorManager: EditorManager;
|
|
123
|
+
|
|
124
|
+
@inject(FrontendApplication)
|
|
125
|
+
protected readonly app: FrontendApplication;
|
|
126
|
+
|
|
127
|
+
@inject(ILogger) @named('task')
|
|
128
|
+
protected readonly logger: ILogger;
|
|
129
|
+
|
|
130
|
+
@inject(WidgetManager)
|
|
131
|
+
protected readonly widgetManager: WidgetManager;
|
|
132
|
+
|
|
133
|
+
@inject(ContributionProvider) @named(TaskContribution)
|
|
134
|
+
protected readonly contributionProvider: ContributionProvider<TaskContribution>;
|
|
135
|
+
|
|
136
|
+
@inject(TaskProviderRegistry)
|
|
137
|
+
protected readonly taskProviderRegistry: TaskProviderRegistry;
|
|
138
|
+
|
|
139
|
+
@inject(TaskResolverRegistry)
|
|
140
|
+
protected readonly taskResolverRegistry: TaskResolverRegistry;
|
|
141
|
+
|
|
142
|
+
@inject(TaskService)
|
|
143
|
+
protected readonly taskService: TaskService;
|
|
144
|
+
|
|
145
|
+
@inject(TaskSchemaUpdater)
|
|
146
|
+
protected readonly schemaUpdater: TaskSchemaUpdater;
|
|
147
|
+
|
|
148
|
+
@inject(StorageService)
|
|
149
|
+
protected readonly storageService: StorageService;
|
|
150
|
+
|
|
151
|
+
@inject(TaskRunningQuickOpen)
|
|
152
|
+
protected readonly taskRunningQuickOpen: TaskRunningQuickOpen;
|
|
153
|
+
|
|
154
|
+
@inject(TaskTerminateQuickOpen)
|
|
155
|
+
protected readonly taskTerminateQuickOpen: TaskTerminateQuickOpen;
|
|
156
|
+
|
|
157
|
+
@inject(TaskRestartRunningQuickOpen)
|
|
158
|
+
protected readonly taskRestartRunningQuickOpen: TaskRestartRunningQuickOpen;
|
|
159
|
+
|
|
160
|
+
@inject(TaskWatcher)
|
|
161
|
+
protected readonly taskWatcher: TaskWatcher;
|
|
162
|
+
|
|
163
|
+
@inject(StatusBar)
|
|
164
|
+
protected readonly statusBar: StatusBar;
|
|
165
|
+
|
|
166
|
+
@inject(WorkspaceService)
|
|
167
|
+
protected readonly workspaceService: WorkspaceService;
|
|
168
|
+
|
|
169
|
+
@postConstruct()
|
|
170
|
+
protected init(): void {
|
|
171
|
+
this.taskWatcher.onTaskCreated(() => this.updateRunningTasksItem());
|
|
172
|
+
this.taskWatcher.onTaskExit(() => this.updateRunningTasksItem());
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
onStart(): void {
|
|
176
|
+
this.contributionProvider.getContributions().forEach(contrib => {
|
|
177
|
+
if (contrib.registerResolvers) {
|
|
178
|
+
contrib.registerResolvers(this.taskResolverRegistry);
|
|
179
|
+
}
|
|
180
|
+
if (contrib.registerProviders) {
|
|
181
|
+
contrib.registerProviders(this.taskProviderRegistry);
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
this.schemaUpdater.update();
|
|
185
|
+
|
|
186
|
+
this.storageService.getData<{ recent: TaskConfiguration[] }>(TASKS_STORAGE_KEY, { recent: [] })
|
|
187
|
+
.then(tasks => this.taskService.recentTasks = tasks.recent);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
onStop(): void {
|
|
191
|
+
const recent = this.taskService.recentTasks;
|
|
192
|
+
this.storageService.setData<{ recent: TaskConfiguration[] }>(TASKS_STORAGE_KEY, { recent });
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* Contribute a status-bar item to trigger
|
|
197
|
+
* the `Show Running Tasks` command.
|
|
198
|
+
*/
|
|
199
|
+
protected async updateRunningTasksItem(): Promise<void> {
|
|
200
|
+
const id = 'show-running-tasks';
|
|
201
|
+
const items = await this.taskService.getRunningTasks();
|
|
202
|
+
if (!!items.length) {
|
|
203
|
+
this.statusBar.setElement(id, {
|
|
204
|
+
text: `$(tools) ${items.length}`,
|
|
205
|
+
tooltip: TaskCommands.TASK_SHOW_RUNNING.label,
|
|
206
|
+
alignment: StatusBarAlignment.LEFT,
|
|
207
|
+
priority: 2,
|
|
208
|
+
command: TaskCommands.TASK_SHOW_RUNNING.id,
|
|
209
|
+
});
|
|
210
|
+
} else {
|
|
211
|
+
this.statusBar.removeElement(id);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
registerCommands(registry: CommandRegistry): void {
|
|
216
|
+
registry.registerCommand(
|
|
217
|
+
TaskCommands.WORKBENCH_RUN_TASK,
|
|
218
|
+
{
|
|
219
|
+
isEnabled: () => true,
|
|
220
|
+
execute: async (label: string) => {
|
|
221
|
+
const didExecute = await this.taskService.runTaskByLabel(this.taskService.startUserAction(), label);
|
|
222
|
+
if (!didExecute) {
|
|
223
|
+
this.quickOpenTask.open();
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
registry.registerCommand(
|
|
230
|
+
TaskCommands.TASK_RUN,
|
|
231
|
+
{
|
|
232
|
+
isEnabled: () => true,
|
|
233
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
234
|
+
execute: (...args: any[]) => {
|
|
235
|
+
const [source, label, scope] = args;
|
|
236
|
+
if (source && label) {
|
|
237
|
+
return this.taskService.run(this.taskService.startUserAction(), source, label, scope);
|
|
238
|
+
}
|
|
239
|
+
return this.quickOpenTask.open();
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
);
|
|
243
|
+
registry.registerCommand(
|
|
244
|
+
TaskCommands.TASK_RUN_BUILD,
|
|
245
|
+
{
|
|
246
|
+
isEnabled: () => this.workspaceService.opened,
|
|
247
|
+
execute: () =>
|
|
248
|
+
this.quickOpenTask.runBuildOrTestTask('build')
|
|
249
|
+
}
|
|
250
|
+
);
|
|
251
|
+
registry.registerCommand(
|
|
252
|
+
TaskCommands.TASK_RUN_TEST,
|
|
253
|
+
{
|
|
254
|
+
isEnabled: () => this.workspaceService.opened,
|
|
255
|
+
execute: () =>
|
|
256
|
+
this.quickOpenTask.runBuildOrTestTask('test')
|
|
257
|
+
}
|
|
258
|
+
);
|
|
259
|
+
registry.registerCommand(
|
|
260
|
+
TaskCommands.TASK_ATTACH,
|
|
261
|
+
{
|
|
262
|
+
isEnabled: () => true,
|
|
263
|
+
execute: () => this.quickOpenTask.attach()
|
|
264
|
+
}
|
|
265
|
+
);
|
|
266
|
+
registry.registerCommand(
|
|
267
|
+
TaskCommands.TASK_RUN_LAST,
|
|
268
|
+
{
|
|
269
|
+
execute: async () => {
|
|
270
|
+
if (!await this.taskService.runLastTask(this.taskService.startUserAction())) {
|
|
271
|
+
await this.quickOpenTask.open();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
);
|
|
276
|
+
registry.registerCommand(
|
|
277
|
+
TaskCommands.TASK_RUN_TEXT,
|
|
278
|
+
{
|
|
279
|
+
isVisible: () => !!this.editorManager.currentEditor,
|
|
280
|
+
isEnabled: () => !!this.editorManager.currentEditor,
|
|
281
|
+
execute: () => this.taskService.runSelectedText()
|
|
282
|
+
}
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
registry.registerCommand(
|
|
286
|
+
TaskCommands.TASK_CONFIGURE,
|
|
287
|
+
{
|
|
288
|
+
execute: () => this.quickOpenTask.configure()
|
|
289
|
+
}
|
|
290
|
+
);
|
|
291
|
+
|
|
292
|
+
registry.registerCommand(
|
|
293
|
+
TaskCommands.TASK_OPEN_USER,
|
|
294
|
+
{
|
|
295
|
+
execute: () => {
|
|
296
|
+
this.taskService.openUserTasks();
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
registry.registerCommand(
|
|
302
|
+
TaskCommands.TASK_CLEAR_HISTORY,
|
|
303
|
+
{
|
|
304
|
+
execute: () => this.taskService.clearRecentTasks()
|
|
305
|
+
}
|
|
306
|
+
);
|
|
307
|
+
|
|
308
|
+
registry.registerCommand(
|
|
309
|
+
TaskCommands.TASK_SHOW_RUNNING,
|
|
310
|
+
{
|
|
311
|
+
execute: () => this.taskRunningQuickOpen.open()
|
|
312
|
+
}
|
|
313
|
+
);
|
|
314
|
+
|
|
315
|
+
registry.registerCommand(
|
|
316
|
+
TaskCommands.TASK_TERMINATE,
|
|
317
|
+
{
|
|
318
|
+
execute: () => this.taskTerminateQuickOpen.open()
|
|
319
|
+
}
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
registry.registerCommand(
|
|
323
|
+
TaskCommands.TASK_RESTART_RUNNING,
|
|
324
|
+
{
|
|
325
|
+
execute: () => this.taskRestartRunningQuickOpen.open()
|
|
326
|
+
}
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
registerMenus(menus: MenuModelRegistry): void {
|
|
331
|
+
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS, {
|
|
332
|
+
commandId: TaskCommands.TASK_RUN.id,
|
|
333
|
+
order: '0'
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS, {
|
|
337
|
+
commandId: TaskCommands.TASK_RUN_BUILD.id,
|
|
338
|
+
order: '1'
|
|
339
|
+
});
|
|
340
|
+
|
|
341
|
+
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS, {
|
|
342
|
+
commandId: TaskCommands.TASK_RUN_TEST.id,
|
|
343
|
+
order: '2'
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS, {
|
|
347
|
+
commandId: TaskCommands.TASK_RUN_LAST.id,
|
|
348
|
+
order: '3'
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS, {
|
|
352
|
+
commandId: TaskCommands.TASK_ATTACH.id,
|
|
353
|
+
order: '4'
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS, {
|
|
357
|
+
commandId: TaskCommands.TASK_RUN_TEXT.id,
|
|
358
|
+
order: '5'
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS_INFO, {
|
|
362
|
+
commandId: TaskCommands.TASK_SHOW_RUNNING.id,
|
|
363
|
+
label: TaskCommands.TASK_SHOW_RUNNING.label + '...',
|
|
364
|
+
order: '0'
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS_INFO, {
|
|
368
|
+
commandId: TaskCommands.TASK_RESTART_RUNNING.id,
|
|
369
|
+
label: TaskCommands.TASK_RESTART_RUNNING.label,
|
|
370
|
+
order: '1'
|
|
371
|
+
});
|
|
372
|
+
|
|
373
|
+
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS_INFO, {
|
|
374
|
+
commandId: TaskCommands.TASK_TERMINATE.id,
|
|
375
|
+
label: TaskCommands.TASK_TERMINATE.label + '...',
|
|
376
|
+
order: '2'
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
menus.registerMenuAction(TerminalMenus.TERMINAL_TASKS_CONFIG, {
|
|
380
|
+
commandId: TaskCommands.TASK_CONFIGURE.id,
|
|
381
|
+
order: '0'
|
|
382
|
+
});
|
|
383
|
+
|
|
384
|
+
menus.registerMenuAction(CommonMenus.MANAGE_SETTINGS, {
|
|
385
|
+
commandId: TaskCommands.TASK_OPEN_USER.id,
|
|
386
|
+
label: nls.localizeByDefault('User Tasks'),
|
|
387
|
+
order: 'a40'
|
|
388
|
+
});
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
registerQuickAccessProvider(): void {
|
|
392
|
+
this.quickOpenTask.registerQuickAccessProvider();
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
registerKeybindings(keybindings: KeybindingRegistry): void {
|
|
396
|
+
keybindings.registerKeybinding({
|
|
397
|
+
command: TaskCommands.TASK_RUN_LAST.id,
|
|
398
|
+
keybinding: 'ctrlcmd+shift+k',
|
|
399
|
+
when: '!textInputFocus || editorReadonly'
|
|
400
|
+
});
|
|
401
|
+
}
|
|
402
|
+
}
|