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

Option to run tasks.json from launch.json even if it doesn't define multiple tasks #10211

Closed
joshtynjala opened this issue Aug 5, 2016 · 5 comments
Assignees
Labels
feature-request Request for new features or functionality tasks Task system issues
Milestone

Comments

@joshtynjala
Copy link

launch.json offers the preLaunchTask field to run a specific task before debugging. This works great if I'm using Gulp or something else that supports multiple task names. However, if I set up a tasks.json that simply runs an executable, such as a compiler, there seems to be no easy way to run this singular task before launching. There is no task name, so I have nothing to pass to preLaunchTask. I'm forced to manually build with Ctrl+Shift+B before I launch.

It would be great if I could set it up so that my tasks.json would run automatically on launch. Maybe a new field, like the example below, where it runs whatever is associated with Ctrl+Shift+B:

{
    "preLaunchRunBuildTask": true
}
@weinand weinand added debug Debug viewlet, configurations, breakpoints, adapter issues tasks Task system issues labels Aug 9, 2016
@isidorn isidorn added the feature-request Request for new features or functionality label Aug 23, 2016
@isidorn isidorn added this to the Backlog milestone Aug 23, 2016
@isidorn
Copy link
Contributor

isidorn commented Aug 23, 2016

fyi @dbaeumer

@dbaeumer
Copy link
Member

@joshtynjala if you only have one command in the tasks.json you can refer to that 'task' using the command string. If the command is for example 'npm' we generate a task with the name npm which you then can use in the launch.json.

I agree that this might be cumbersome if the command is a full path. Instead of having the launch.json fixing this we should allow to name single tasks in the tasks.json.

@isidorn isidorn removed the debug Debug viewlet, configurations, breakpoints, adapter issues label Aug 23, 2016
@isidorn isidorn assigned dbaeumer and unassigned isidorn Aug 23, 2016
@joshtynjala
Copy link
Author

if you only have one command in the tasks.json you can refer to that 'task' using the command string.

Ah, thank you! I didn't realize that. Perhaps a note in this document that makes this special case more obvious would be helpful. I would not have guessed on my own that the "command" field could be used like this.

I agree that this might be cumbersome if the command is a full path.

Agreed. Luckily, I'm running things that are in the PATH environment variable.

Instead of having the launch.json fixing this we should allow to name single tasks in the tasks.json.

This would be convenient! I'm planning to write some tutorials for the language extension that I'm working on, and I'm sure at least some of my users will prefer to run commands with the full path. Being able to name the task "build" or "compile" in the tutorial would make things cleaner for everyone, full path or not.

@isidorn
Copy link
Contributor

isidorn commented Aug 23, 2016

ping @gregvanl

@alexr00
Copy link
Member

alexr00 commented Dec 20, 2018

You can now add a label to any task, and use that label to refer to the task in preLaunchTask

@alexr00 alexr00 closed this as completed Dec 20, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality tasks Task system issues
Projects
None yet
Development

No branches or pull requests

5 participants