-
Notifications
You must be signed in to change notification settings - Fork 38.5k
Description
I'm attempting to move over to TaskProvider for our extension rather than custom shell tasks. Per these docs, the TaskDefinition provided through TaskProvider is used "To uniquely identify a task in the system", but I don't just want to "identify" the task, I want to let users customize it as well.
For example, we want to provide a task that starts the Azure Functions host before a user debugs. The launch.json would look like this:
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to JavaScript Functions",
"type": "node",
"request": "attach",
"port": 5858,
"preLaunchTask": "func: host start"
}
]
}
And I would provide the "func: host start" task like this:
export class FuncTaskProvider implements TaskProvider {
public async provideTasks(token?: CancellationToken | undefined): Promise<Task[]> {
const taskDefinition: TaskDefinition = { type: 'func', command: 'host start', port: 5858 };
const task: Task = new Task(
taskDefinition,
'host start',
'func',
new ProcessExecution('func', ['host', 'start', '--language-worker', '--', `--inspect=${taskDefinition.port}`]),
'$func-watch'
);
return [task];
}
public async resolveTask(task: Task, token?: CancellationToken | undefined): Promise<Task> {
}
}However, as soon as I try to change the port, I get an error like this:
Error: The func task detection didn't contribute a task for the following configuration:
{
"type": "func",
"command": "host start",
"port": 5959,
"problemMatcher": [
"$func-watch"
]
}
The task will be ignored.
cc @dbaeumer continuing the conversation from here: #57707. You mentioned this issue #4758, but that seems focused on prompting users. We don't want to prompt users at all - we just want to give them the ability to customize if necessary.