Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'tasks.registerTaskProvider' for Plugin API #3719

Merged
merged 1 commit into from
Dec 10, 2018

Conversation

RomanNikitenko
Copy link
Contributor

@RomanNikitenko RomanNikitenko commented Dec 4, 2018

Add 'tasks.registerTaskProvider' for Plugin API
Task Provider allows a plugin to provide and resolve tasks.

Example:

theia.tasks.registerTaskProvider('shell', {

    provideTasks: token => {
        const buildTask = {
            name: 'yarn build',
            definition: {
                type: 'shell'
            },
            execution: {
                command: 'yarn',
                args: ['run', 'build'],
                options: {
                    cwd: '/home/projects/task-provider-plugin'
                }
            },

        };

        const watchTask = {
            name: 'yarn watch',
            definition: {
                type: 'shell'
            },
        }

        tasks.push(buildTask);
        tasks.push(watchTask);

        return tasks;
    },

    resolveTask: task => {
        if (task.name === 'yarn watch') {
            task.execution = {
                commandLine: 'yarn run watch',
                options: {
                    cwd: '/home/projects/task-provider-plugin'
                }
            }
        }
        return task;
    }
});

`
Build task in the example has name, definition and execution sections.
Watch task does not have execution section, but this info can be added when provider resolves the task.
Video: https://youtu.be/-aHEBwc_x3s

@RomanNikitenko RomanNikitenko added the plug-in system issues related to the plug-in system label Dec 4, 2018
export class ProcessExecution {
private _process: string;
private _args: string[];
private _options: theia.ProcessExecutionOptions | undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: using _ as a prefix for the private properties is against the coding guidelines https://github.com/theia-ide/theia/wiki/Coding-Guidelines#names
Please, check the properties in other classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@azatsarynnyy thank you, I will check!

@RomanNikitenko RomanNikitenko force-pushed the tasks-provider branch 2 times, most recently from de6dd45 to 6d5f9a7 Compare December 7, 2018 04:47
Signed-off-by: Roman Nikitenko <rnikiten@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plug-in system issues related to the plug-in system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants