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

Tasks 2.0 integration with launch.json #29013

Closed
ytimenkov opened this issue Jun 19, 2017 · 3 comments
Closed

Tasks 2.0 integration with launch.json #29013

ytimenkov opened this issue Jun 19, 2017 · 3 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug tasks Task system issues verified Verification succeeded
Milestone

Comments

@ytimenkov
Copy link

ytimenkov commented Jun 19, 2017

I want to specify auto detected task as a prelaunch task (npm run compile in my case).
Right task name is just "preLaunchTask": "run compile", which I found only by looking into VS Code sources.

There are 2 problems with this:

1. there is no way for user to guess "task name" from UI

Task picker looks:
image
I tried "npm: run compile", "npm", "npm run compile" - nothing worked.

Even when I try to customize task I get tasks.json:

{
    "version": "2.0.0",
    "tasks": [
        {
            "customize": "vscode.npm.run compile",
            "taskName": "npm: run compile",
            "problemMatcher": []
        }
    ]
}

Which gives no clue about task name being just "run compile".

2. Possible name clashes

If no extension name is involved in lookup process, what if task is simply called "build"?

@dbaeumer
Copy link
Member

We discussed that yesterday and we will support specifying the label in the launch.json.

@dbaeumer dbaeumer added this to the June 2017 milestone Jun 21, 2017
@dbaeumer dbaeumer added tasks Task system issues bug Issue identified by VS Code Team member as probable bug labels Jun 21, 2017
@dbaeumer
Copy link
Member

@isidorn this required some minor changes in the DebugService. Instead of getting all tasks I added a method to the task service to receive a task using the string in the preLaunchTask property. This allows the task framework to to care of how a task is found. Please have a look at the commit attached to this issue.

@ytimenkov you can now do the following:

  • either use the task's name as shown in the UI. In your example 'npm: run compile' or you can assign an identifier in the tasks.json and use that.
{
	"version": "2.0.0",
	"tasks": [
		{
			"type": "npm",
			"script": "compile",
			"identifier": "npm>run>compile",
			"problemMatcher": [
				"$tsc"
			]
		}
	]
}

defines the identifier npm>run>compile. The launch.json then looks like this:

		{
			"type": "node",
			"request": "launch",
			"name": "Launch Program",
			"program": "${workspaceRoot}/helloWorld.js",
			"preLaunchTask": "npm>run>compile",
			"outFiles": []
		}

@isidorn
Copy link
Contributor

isidorn commented Jun 26, 2017

@dbaeumer I checked these changes and it looks good to me. Should we create a Test Plan item for this?

@roblourens roblourens added the verified Verification succeeded label Jun 30, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 17, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug tasks Task system issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants