Skip to content

Conversation

@szotp
Copy link
Contributor

@szotp szotp commented Jul 22, 2020

Enable previewBuildRunnerTasks in flutter project and then execute
Command Palette > Tasks: Run task > Show all tasks...

You will see this error:
The task provider for "pub" tasks unexpectedly provided a task of type "flutter".

Probably because pub is hardcoded here:

context.subscriptions.push(vs.tasks.registerTaskProvider("pub", new PubBuildRunnerTaskProvider(sdks)));

So I changed the code to always use "pub".

@DanTup
Copy link
Member

DanTup commented Jul 23, 2020

I'm not seeing this error - when I pick "Show all Tasks" I just get this empty box:

Screenshot 2020-07-23 at 14 13 33

Where does the error appear for you?

@DanTup
Copy link
Member

DanTup commented Jul 23, 2020

It's possible the better fix would be conditionally using pub/flutter here:

context.subscriptions.push(vs.tasks.registerTaskProvider("pub", new PubBuildRunnerTaskProvider(sdks)));

Though I'm curious why I'm not seeing the same error you do.

@DanTup
Copy link
Member

DanTup commented Jul 23, 2020

Ok, the issue was that I didn't have bulid_runner referenced.

I think a better fix would be to use the correct ID based on the type of project (for example if you have a workspace with multiple projects, we should show the correct one for each).

Something more like this:

patch.txt

If I open a workspace with a Flutter + Dart project, this will then show the correct type:

Screenshot 2020-07-23 at 14 23 44

WDYT?

@DanTup DanTup added this to the v3.13.0 milestone Jul 23, 2020
@DanTup DanTup added in commands Relates to commands (usually invoked from the command Palette) is bug fix labels Jul 23, 2020
@szotp
Copy link
Contributor Author

szotp commented Jul 24, 2020

eh, I wish that flutter did not create this pub/flutter division, it seems completely pointless.

But your proposal looks good, I will update my MR later.

@DanTup DanTup modified the milestones: v3.13.0, v3.14.0 Jul 28, 2020
@szotp
Copy link
Contributor Author

szotp commented Jul 29, 2020

Ok, I have updated.

But, while doing this, I had another idea: maybe task provider should just have a different name that works both for pub and flutter, and then decide what to call when task is being ran.

Instead of pub/flutter: build_runner watch use:

Option A: build_runner: watch
Option B: dart: build_runner watch

If this won't work for some reason, please merge as it is.

@DanTup
Copy link
Member

DanTup commented Jul 30, 2020

I think it probably would - I'm not sure why I previously separated them in the UI. I don't think anyone running build_runner would be specifically looking for "flutter" so I think it could all just be using a type of pub. If you want to strip that out and simplify it (so the only difference is probably inside createBuildRunnerCommandBackgroundTask where it picks the program/args), that sounds good to me (you could also then remove the flutter taskDefinition from package.json).

Thanks!

@szotp
Copy link
Contributor Author

szotp commented Jul 31, 2020

Let's just use pub then. PR updated.

@DanTup
Copy link
Member

DanTup commented Aug 3, 2020

LGTM, thanks!

@DanTup DanTup merged commit b8b7243 into Dart-Code:master Aug 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in commands Relates to commands (usually invoked from the command Palette) is bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants