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

Run the default build task from launch configuration #32239

Closed
joshtynjala opened this issue Aug 10, 2017 · 9 comments · Fixed by #80478
Closed

Run the default build task from launch configuration #32239

joshtynjala opened this issue Aug 10, 2017 · 9 comments · Fixed by #80478
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality on-testplan

Comments

@joshtynjala
Copy link

joshtynjala commented Aug 10, 2017

Currently, I can specify a preLaunchTask field in a launch configuration to run a task before launching. That's great! To use preLaunchTask, I need to give my task an identifier first. Typically, I want to run the default build task before I launch, though. VSCode already knows which task is the default build task, so I feel like there should be a way to tell VSCode to run this task without giving it an identifier.

If one of my tasks.json entries contains the following snippet, VSCode knows that this is the default build task:

"group": {
	"kind": "build",
	"isDefault": true
}

What if there were a field in launch.json named something like preLaunchBuild that could be set to true to tell it to run the default build task before launching? preLaunchTask would still be useful for running other tasks, but if I just want to run the default build task, I don't need to take the extra step of giving the default build task its own identifier.

@vscodebot vscodebot bot added the tasks Task system issues label Aug 10, 2017
@weinand weinand added debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality labels Aug 10, 2017
@weinand weinand self-assigned this Aug 10, 2017
@weinand weinand added this to the Backlog milestone Sep 29, 2017
@weinand weinand removed their assignment Sep 29, 2017
@dbaeumer
Copy link
Member

dbaeumer commented Nov 9, 2017

The ITaskServer offers API getTasksForGroup where debug could as for build tasks. So instead of using the name debug could use a generic pre launch name.

@dbaeumer dbaeumer removed the tasks Task system issues label Nov 9, 2017
@weinand
Copy link
Contributor

weinand commented Nov 14, 2017

Adding a "preLaunchBuild" attribute to launch configs results in a proliferation of common attributes.(which we want to avoid).

I would rather prefer to have a standard name for the "default build" so that IntelliSense could suggest a good default value.

@dbaeumer do I understand you correctly that the default build task is not available under a standard name?

If this is the case, I suggest that we introduce a variable for that:

"preLaunchTask": "${defaultBuildTask}"

@weinand weinand modified the milestones: Backlog, On Deck Nov 14, 2017
@joshtynjala
Copy link
Author

A standard name or a variable are both good alternatives to my suggestion. Thanks!

@dbaeumer
Copy link
Member

@weinand no there is not since the name could be something already defined in a gulp file.

However what users can do is to give a task and identifier which could be standard. But this is like adding

"group": {
	"kind": "build",
	"isDefault": true
}

which IMO is enough to denote the standard build task. I have no problem if the ITaskServer offers API to retrieve the standard build task(s).

@weinand weinand assigned alexr00 and unassigned dbaeumer Aug 22, 2019
@weinand
Copy link
Contributor

weinand commented Aug 22, 2019

@isidorn @alexr00 I'd like to resolve this and I see the following two options (under the assumption that I do not want to add a new common attribute to launch configs:

  • introduce a new variable that expands into the default build name, e.g. ${defaultBuildTask}.
  • since preLaunchTask accepts a complete structure (as an alternative to the task name), we could introduce a new attribute "useDefaultBuildTask": "true" inside that structure.

I prefer the first option (the variable).

@isidorn I've created #79625 for the missing code completion on the preLaunchTask structure.

@isidorn
Copy link
Contributor

isidorn commented Aug 22, 2019

@weinand agree that we should not add a new common attribute to launch.json for this.

@alexr00 please note that the preLaunchTask can either be a string or a ITaskIdentifier as defined here. I am open to whatever solution you prefer and what makes sense from the tasks standpoint. Something that is aligned with the current way we identify default tasks in task land.

@alexr00
Copy link
Member

alexr00 commented Aug 22, 2019

I like ${defaultBuildTask}, but there is still the case where there is no default build task. In that case, we can show the build task picker as we do when the Tasks: Run Build Task command is executed.

All of the work for this is in the configuration resolver and in tasks. I will aim to do it in September.

@alexr00 alexr00 modified the milestones: On Deck, September 2019 Aug 22, 2019
@isidorn
Copy link
Contributor

isidorn commented Aug 23, 2019

@alexr00 makes sense. However currentyl the configurationResolverService has no notion of the debug and task land. This way you would have to introduce one that sounds task specific. This works for me, but just to keep in mind. Maybe the cleanest approach would be that the task land somehow contributes this to the configurationResolverService.

alexr00 added a commit that referenced this issue Sep 10, 2019
* Contributable variables for configuration resolver

Fixes #32239
@isidorn isidorn added the verification-needed Verification of issue is requested label Sep 19, 2019
@isidorn
Copy link
Contributor

isidorn commented Sep 19, 2019

@alexr00 adding verification needed here, if you plan to write a test plan item feel free to remove the label. Also unassigning myself since you did all the work.

@isidorn isidorn removed their assignment Sep 19, 2019
@alexr00 alexr00 added on-testplan and removed verification-needed Verification of issue is requested labels Sep 30, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality on-testplan
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants