-
Notifications
You must be signed in to change notification settings - Fork 300
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
Automatically run build_runner on VS Code startup, not working #1516
Comments
After the VS Code February 2018 update, this doesn't appear anymore. |
VS Code 1.32 has some another serious bug though - see #1518. I would recommend staying on v1.31 until a fix is released (they have a fix, and I've verified from source, but it hasn't been released). |
Ok sorry to disturb again, but after I installed this release: https://github.com/Dart-Code/Dart-Code/releases/tag/v2.23.0-beta.2 I then tried to uninstall this beta release and install the stable release again. But this didn't help either. I have really no idea, what causes this problem. But after the VS Code update, I restarted VS Code several times, because I couldn't believe, that the update fixed this. And it worked every time. If you need anything else to reproduce this, I am here to help. |
Are you able to attach the smallest possible folder you can repro it with? |
@HerrNiklasRaab I can reproduce your issue, but if I add |
Sadly it doesn't work. I tried the following:
Anything else that I can try? |
@HerrNiklasRaab Two things to check:
For some reason, for me, it only found the task (and prompted to enable auto-running) when I first tried to run it, which means the extension had already had plenty of time to load. |
Hey @DanTup,
About this, I am not 100% sure what you meant and if I should check and try to confirm this behaviour. |
@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 (you shouldn't need to do that, but let me know if that fixes it, and I can improve it here) |
Ok, I have news. Only when the a .dart file is open and active (the tab of the .dart file is active) the tasks are starting without any error. To the result below of my previous post I got, because I opened a .dart file and switched to another tab
Could you try to open my project without any tabs or files open, while restarting? |
I did that, but it still runs them. I even collapsed all of the folders in explorer. It seems to always activate the extension (I can see "No devices" in the status bar) despite that. When you see this issue (eg. no dart files open), do you see "No devices" in the status bar and Dart listed if you run the "Show running extensions" command? Also - you're testing by opening dev.code-workspace, right? Are you on v1.31 or v1.32 of VS Code? |
Ok, I can repro on Windows :) |
Ok, I think I've gotten to the bottom of this. It's a race condition, and it happens because the task may try to run before the extension is loaded. The MS sample for task providers activates with this command:
Adding this fixes it, however this seems like an insane fix to me - it means the extension activates whenever anyone wants to run any task. I'm going to see if I can find a better way - since VS Code knows if the extension is going to contribute tasks (they're in the manifest) I don't see why we should need this. |
Ok, I'm waiting to hear back on microsoft/vscode#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. |
Sounds great! 👍 |
Tidying up open issues - I believe the remaining issue here is entirely VS Code's (linked above) and if/once that's fixed, it should work here to without any changes in the Dart extension. |
I think between a fix made in microsoft/vscode#70303 and microsoft/vscode#126238, this should be fixable now, though requires us to adopt the new |
An issue for a problem, which came up in this issue: #1211 (comment)
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:
"runOptions"
):Now there is a warning:
And when I restart Visual Studio I get an error notification and following output:
Similar to this one:
dart-lang/build#1025 (comment)
Any idea?
The text was updated successfully, but these errors were encountered: