Skip to content

Cannot Create keybinding to restart a specific Task #35910

Closed

Description

@mrawdon
  • VSCode Version: 1.17.0-insider
  • OS Version: Windows 10

Steps to Reproduce:

  1. Add these keybindings
[
	{"key":"f6","command":"workbench.action.tasks.runTask", "args":"run"},
	{"key":"ctrl+f6","command":"workbench.action.tasks.restartTask", "args":"run"}
]
  1. Type f6
  2. My run task begins
  3. Type Ctrl + f6
  4. The task selection screen pops up
    image

Reproduces without extensions: Yes

It seems like he arg behavior in runTask code https://github.com/Microsoft/vscode/blob/c8eb003402ce5d6e0529a4da459b863ac5610af9/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts#L1975

Needs to be replicated in runRestartTaskCommand
https://github.com/Microsoft/vscode/blob/c8eb003402ce5d6e0529a4da459b863ac5610af9/src/vs/workbench/parts/tasks/electron-browser/task.contribution.ts#L2163

The same issue also exists with runTerminateCommand

Activity

  1. vemoo commented on Oct 14, 2017

    @vemoo
    Contributor

    Is this issue available to work on? It would be my first time contributing, so I may need some guidance.

  2. vemoo commented on Oct 15, 2017

    @vemoo
    Contributor

    I have a question about what the terminate command should do. Right now if the user is in the terminal, it asks for a task to terminate, otherwise it terminates all tasks.

    But that's different from what restartTask command does right now, when in the terminal, it ask for a task to restart, but otherwise it restarts the first task.

    I have changed the restart behaviour to restart the task passed as argument when found, or ask for one to restart, whether we are in the terminal or not. Should the terminate command do the same?

  3. dbaeumer commented on Oct 16, 2017

    @dbaeumer
    Member

    vemoo thanks for looking into this. If the tasks a not executed in the terminal then they are executed in the old output runner which can only execute one task at a time. This is why the code is different for the non terminal case.

    To answer your question: if the task can't be found you should show a picker to run it. If in non terminal no task name is required since there can only be one task.

  4. vemoo commented on Oct 17, 2017

    @vemoo
    Contributor

    I have implemented the fixes and it wasn't necesary to check whether the task system is the old one or not. Because the getActiveTasks method is implemented for both, and for the ProcessTaskSystem it returns one or no tasks.

    I've also found and fixed a couple of bugs in processTaskSystem.ts when terminating the task.

    Should I create a pull request?

  5. dbaeumer commented on Oct 18, 2017

    @dbaeumer
    Member

    vemoo yes please.

  6. dbaeumer commented on Jun 26, 2018

    @dbaeumer
    Member

    To verify create a key binding like

    {
        "key": "ctrl+shift+w",
        "command": "workbench.action.tasks.restartTask",
        "args": {
            "type": "npm",
            "script": "compile"
        }
    }
    

    When using the above example ensure that the package.json contains a compile script that contains a tsc compile command in watch mode. Alternatively you can have a fake compiler that sits and does nothing (echo something every n seconds)

    • start the compile task
    • press the keybinding from above
    • ensure the task restarts.
  7. locked and limited conversation to collaborators on Jul 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

feature-requestRequest for new features or functionalityhelp wantedIssues identified as good community contribution opportunitiestasksTask system issuesverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions