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

Starting Debug with a preLauch task referenced from an npm script fails when launching the second time #29922

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

Comments

@dbaeumer
Copy link
Member

  • clone vscode-eslint
  • change to eslint-server
  • npm install
  • npm compile
  • change to ../eslint
  • npm install
  • open code
  • change the tasks.json to:
{
	// See https://go.microsoft.com/fwlink/?LinkId=733558
	// for the documentation about the tasks.json format
	"version": "2.0.0",
	"tasks": [
		{
			"type": "npm",
			"script": "watch",
			"isBackground": true,
			"problemMatcher": [
				"$tsc-watch"
			],
			"group": {
				"kind": "build",
				"isDefault": true
			}
		}
	]
}
  • press F5
  • Observer: everything is happy
  • stop debugging
  • press F5
  • you get

capture

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

Will look into this. Might not be too critical since it requires 2.0.0 runner but we should understand why this is happening.

@dbaeumer
Copy link
Member Author

dbaeumer commented Jun 30, 2017

The reason for this is that debug can't simple compare the name anymore since a prelaunch task can be referenced now by: name or label or user defined identifier or TaskDefinition (e.g. `{type: 'npm', script: 'watch')). Task always had an id which I try to keep as stable as possible even if the user edits the tasks.json file. Debug should use the id instead of the taskName. For June I propose the following change in debugService.ts line 860ff

if (this.lastTaskEvent && (this.lastTaskEvent.taskName === taskName || this.lastTaskEvent.taskId === task._id)) {
	return TPromise.as(null);
}

I still compare the name to not break other scenarios so late in the game.

@dbaeumer
Copy link
Member Author

How do I compute the id: for tasks defined in the tasks.json it is a UUID based on the name and the position in the file. For tasks reference in the tasks.json or contributed by and extension it is a hash code (md5) over the task definition (e.g. {type: 'npm', script: 'watch'}). So if the user changes the name or the script it will be a different id.

@isidorn
Copy link
Contributor

isidorn commented Jun 30, 2017

Adding verified since this issue is fixed, however when I follow the exact steps in this issue I get the following error after first debug run

screen shot 2017-06-30 at 13 40 04

Only after I add label: npm to tasks.json am I able to verify the original issue.

@dbaeumer is this expected behavior? As it seems that the taskService.get('npm') for the tasks.json you provided above does not return a result

@isidorn isidorn added the verified Verification succeeded label Jun 30, 2017
@dbaeumer
Copy link
Member Author

@isidorn this is expected. The structure of the initial tasks.json file had only one top level task in which case the name is npm. So everything works there. If you customize a contributed task (which the tasks.json in this issue does) then you need to qualify the task to use.

@dbaeumer
Copy link
Member Author

I the above example no task named 'npm' exists. Only the task npm watch task.

@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

2 participants