-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtask-provider-frontend.ts
49 lines (39 loc) · 1.36 KB
/
task-provider-frontend.ts
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
import * as theia from '@theia/plugin';
export function start(context: theia.PluginContext) {
const outputChannel = theia.window.createOutputChannel('Test Channel');
outputChannel.show();
const testCommand = {
id: 'execute-overriden-task',
label: "Execute overriden task"
};
context.subscriptions.push(theia.commands.registerCommand(testCommand, (...args: any[]) => {
theia.commands.executeCommand('task:run', 'customType', 'build', { command: 'yarn', args: ['run', 'watch'] });
}));
theia.tasks.registerTaskProvider('customType', {
provideTasks: () => {
const tasks: theia.Task[] = []
const buildTask = {
name: 'build',
definition: {
type: 'customType'
},
source: 'customType',
execution: {
command: 'yarn',
args: ['run', 'build'],
options: {
cwd: '/home/rnikitenko/projects/theia'
}
},
}
tasks.push(buildTask);
outputChannel.appendLine('=== PLUGIN === provide task: ' + JSON.stringify(buildTask));
return tasks;
},
resolveTask: task => {
return task;
}
});
}
export function stop() {
}