Dart-Code: Automatically run build_runner on VS Code startup, not working

An issue for a problem, which came up in this issue: https://github.com/Dart-Code/Dart-Code/issues/1211#issuecomment-470621513

Here is my project: intersect.zip

@DanTup Yes, at least sort of.

I wanted to start the watch task as soon as I open VS Code. So I did the following:

  1. STRG + SHIFT + P
  2. Typed: “Tasks Configure Task” ENTER
  3. Selected, the Task I wanted to configure
  4. Modified generated task.json to the following (only added "runOptions"):

image

Now there is a warning:

Incorrect type. Expected “object”.

And when I restart Visual Studio I get an error notification and following output:

Error: The pub task detection didn’t contribute a task for the following configuration: { “type”: “pub”, “command”: “watch”, “problemMatcher”: [ “dart-pub-build_runner” ], “runOptions”: { “runOn”: “folderOpen” } } The task will be ignored.

Similar to this one: https://github.com/dart-lang/build/issues/1025#issuecomment-435993458

Any idea?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (11 by maintainers)

Most upvoted comments

I think between a fix made in https://github.com/microsoft/vscode/issues/70303 and https://github.com/microsoft/vscode/issues/126238, this should be fixable now, though requires us to adopt the new onTaskType: activation event.

Ok, I’m waiting to hear back on https://github.com/Microsoft/vscode/issues/70303 before doing any more on this. In my opinion this is a bug - it should not be necessary for an extension that uses tasks to have to activate whenever the user runs any task in VS Code (especially given they don’t seem to want to give us an activation reason).

I hope we could have a more restricted activation event (eg. onTask:pub).

@HerrNiklasRaab I mean, it didn’t pop up to say “Hey, this project has auto-start tasks, do you want to let them run?” until I invoked the “Run Task” command (it didn’t find the task automatically at startup).

I approved the auto-run but still I can’t reproduce the behaviour 🤔

Oh, hangon… If you change type: "pub" to type: "flutter" and reload, does it work?

(you shouldn’t need to do that, but let me know if that fixes it, and I can improve it here)