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

Task extension #686

Closed
marcdumais-work opened this issue Oct 19, 2017 · 5 comments
Closed

Task extension #686

marcdumais-work opened this issue Oct 19, 2017 · 5 comments
Assignees

Comments

@marcdumais-work
Copy link
Contributor

marcdumais-work commented Oct 19, 2017

Tasks

This extension provides the means to execute scripts or executables on the backend, from a frontend client. Events are sent from the backend to the frontend client(s), when a task execution is started (includes task id, underlying process id, other runtime info) and finished (includes exit code, signal received). It's also possible for a frontend client to ask the backend for the list of tasks that are currently running.

We support having multiple frontend task clients that are using the same backend task server. Each client uses its workspace root as context parameter, in all its communications with the backend. Whenever the backend sends notifications to its clients, the original client context is sent along. It's then up-to the clients to determine if they are interested in the event, given its context, and show it to the user or not.

This mechanism makes it possible for multiple clients, opened on the same workspace, to all get the notifications related to all tasks that execute from that workspace. At the same time, clients can ignore tasks that are run from another workspace.

Task Frontend:

task-service

Contains the means for the Task frontend to communicate with the Task backend (server).

UI Contributions

  • a "Run Task" command was added. It's available from a top-level "Task" menu as well as in the command palette. When triggered, it presents the list of known tasks configurations to the user, using the "quick open" list. Upon a task being chosen from there, a request is sent to execute that task, in the backend. When the execution is finished, the task backend sends an event, containing the exit code and signal. ATM that information is shown to the user as a FE notification.

note: If a task is configured as a "terminal" task, a terminal is opened when the task is run, showing its output. Else if the task is "raw", no terminal is started.

  • a "Attach to Task" command was added. With this command, it's possible, from a frontend client, to connect to a (terminal-process-based) task that is executing in the backend, and show its output in a terminal.

task-configurations

A frontend client can have a workspace open. A workspace can have tasks defined in a file: <workspace root>/.theia/tasks.json

The TaskConfigurations class provides the task service with an up-to-date list of task configurations, that are available to execute at that moment, in the currently opened workspace . Then it watches the task configuration file for changes and re-parses it when it changes (e.g. after the user has edited it).

Here's a sample task configuration entry:

     {
        "label": "Test task - list workspace files recursively",
        "processType": "terminal",
        "cwd": "$workspace",
        "processOptions": {
            "command": "ls",
            "args": [
                "-alR"
            ]
        },
        "windowsProcessOptions": {
            "command": "cmd.exe",
            "args": [
                "/c",
                "dir",
                "/s"
            ]
       }
    }

We support using a symbolic $workspace value as part of the "cwd" field. This value is replaced by the value of the frontend's current workspace root directory, in the Task client, before sending the task configuration for execution, to the Task Server.

For some tasks, it might be possible to have the same task configuration, for different platforms. But in other cases, there might be some tweaks that need to be done, specially for the Windows platform. This is supported by having the windowsProcessOptions entry, that overrides the processOptions, on Windows, if present. See example above.

See extension's README.md for more details about task configurations.

Task Backend:

task-server

The Task server is a singleton, that can run and kill tasks. It doesn't know or care directly about which workspace a client has opened. Rather, a task configuration to be executed is expected to contain all required information, either by having an absolute path to the command to execute, or having that command found in the system path or in the configured Task's current working directory ("cwd").

task-manager

The Task Manager is a singleton that keeps track of all tasks that are being executed, in a given task backend. Tasks can be optionally accessed by client context, for e.g. easy lookup of running tasks for a given context.

@marcdumais-work marcdumais-work added the design issues related to design label Oct 19, 2017
marcdumais-work added a commit that referenced this issue Oct 19, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
@marcdumais-work marcdumais-work removed the design issues related to design label Oct 19, 2017
@hexa00
Copy link

hexa00 commented Oct 19, 2017

Did you mean to create a pull request with this ?
I see one commit but I guess this is not a PR yet...?

marcdumais-work added a commit that referenced this issue Oct 20, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Oct 20, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Oct 20, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Oct 20, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Oct 20, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
@marcdumais-work
Copy link
Contributor Author

marcdumais-work commented Oct 20, 2017

@hexa00 PR #690 created!

marcdumais-work added a commit that referenced this issue Oct 20, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Oct 20, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Oct 20, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Oct 24, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Oct 25, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Oct 26, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Oct 30, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Nov 6, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Nov 6, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Nov 10, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Nov 10, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Nov 12, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Nov 13, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
@marcdumais-work marcdumais-work added this to the Theia BETA milestone Nov 14, 2017
@marcdumais-work marcdumais-work mentioned this issue Nov 14, 2017
5 tasks
@marcdumais-work marcdumais-work self-assigned this Nov 14, 2017
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Nov 22, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Dec 1, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 1, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Dec 4, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Dec 4, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Dec 4, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Dec 4, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Dec 5, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 6, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 6, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
@svenefftinge svenefftinge removed this from the Theia BETA milestone Dec 6, 2017
marcdumais-work added a commit to marcdumais-work/theia that referenced this issue Dec 12, 2017
Fixes eclipse-theia#686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 12, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
@svenefftinge
Copy link
Contributor

Just came across this. Might contain some good ideas / experiences microsoft/vscode#15179

marcdumais-work added a commit that referenced this issue Dec 13, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 13, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 13, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 13, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 13, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 13, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 13, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 14, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 14, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 14, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 14, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 18, 2017
Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 18, 2017
This extension provides the means to execute scripts or executables,
from a frontend client, in the backend. Tasks life cycle events are
send from the backend to the frontend clients, whenever a task is
created or terminates. A task client can ask the backend for the list
of tasks that are currently running.

We support having multiple frontend task clients that are using the same
backend task server. Each client uses its workspace root as context
parameter, in all its communications with the backend. Whenever the
backend sends notifications to its clients, the original client context
is sent along. It's then up-to the clients to determine if they are
interested in the event, given its context, and show it to the user or
not.

This mechanism makes it possible for multiple clients, opened on the
same workspace, to all get the notifications related to all tasks that
execute from that workspace. At the same time, clients can ignore tasks
that are run from another workspace.

Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
marcdumais-work added a commit that referenced this issue Dec 18, 2017
This extension provides the means to execute scripts or executables,
from a frontend client, in the backend. Tasks life cycle events are
send from the backend to the frontend clients, whenever a task is
created or terminates. A task client can ask the backend for the list
of tasks that are currently running.

We support having multiple frontend task clients that are using the same
backend task server. Each client uses its workspace root as context
parameter, in all its communications with the backend. Whenever the
backend sends notifications to its clients, the original client context
is sent along. It's then up-to the clients to determine if they are
interested in the event, given its context, and show it to the user or
not.

This mechanism makes it possible for multiple clients, opened on the
same workspace, to all get the notifications related to all tasks that
execute from that workspace. At the same time, clients can ignore tasks
that are run from another workspace.

Fixes #686

Signed-off-by: Marc Dumais <[email protected]>
@vilashProgrammr
Copy link

this doesn't work in my case .
I have creates the task.json file in work-space still runtask doesn't show any tasks to run.

@marcdumais-work
Copy link
Contributor Author

Hi @vilashProgrammr ,

Look here for more recent documentation about Tasks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants