You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Automatic Packages Get on Pubspec change not working if prompt to run "pub get" at startup is ignored #4307
Describe the bug
Hello, I've recently encountered with this odd behavior in my project. I'm aware of the dart.runPubGetOnPubspecChanges setting, which is set to always.
Trying it with a simpler project, it seems to work correctly.
I would like to know what could be causing it to fail in the other project. Is there any way to show the logger messages with the Extension installed from the store? I can see in the implementation that there are several messages when an early return occurs.
The automatic packages get behavior has been working fine for a long time in this project, so something must have changed recently on my end or on vscode.
The messages logged with logger.info in that class should show up in the extension log. If you trigger the fetch-on-save that isn't working and then run the Dart: Open Extension Log command, hopefully you can find those logs in there, which might help understand why it was skipped.
It seems to be working now. A vscode notification popped up mentioning something along the lines of "Project is out of date, Do you want to run pub get?", with an embedded button to run it. I did that and then the pubspec modification triggers started working again.
This notification wasn't appearing before, but I imagine this was preventing the triggers to even work at all.
Unfortunately this is just an assumption, as I wasn't able to view the logs while it was failing.
That's odd, I'm not sure what happened there. The prompt to run "pub get" should appear when you open a project if a few conditions are met - however VS Code hides notifications after around 10 seconds so it's possible if you don't spot it pop up, it can vanish and you won't see it (there is a dot on the notification bell in the status bar, but it's very subtle).
I'm also unsure why that would have preventing the on-save from running, they should be completely unrelated.
If you do see this again and are able to grab a log, please let me know and we can figure out what's up. In the meantime I'll close this as I don't think there's anything I can investigate.
@DanTup I was able to get the bug again.
The pubspec update is being skipped because it says that pub get is already running.
I've tried running pub get from the terminal and from the VSCode "Get packages" command. Both end successfully, but the changes in the pubspec will trigger [General] [Info] Already running pub get, skipping!
Ah, thanks! I see what's happening. We set that flag as if we're running pub around the notification that appears in the bottom corner. So if you don't notice that notification (which VS code hides after ~10s), then it will be forever "locked" as already running, when in reality it didn't start.
changed the title [-]Automatic Packages Get on Pubspec change not working[/-][+]Automatic Packages Get on Pubspec change not working if prompt to run "pub get" at startup is ignored[/+]on Dec 20, 2022
Activity
DanTup commentedon Dec 18, 2022
The messages logged with
logger.infoin that class should show up in the extension log. If you trigger the fetch-on-save that isn't working and then run the Dart: Open Extension Log command, hopefully you can find those logs in there, which might help understand why it was skipped.Please let me know what you find!
davidmartos96 commentedon Dec 19, 2022
It seems to be working now. A vscode notification popped up mentioning something along the lines of "Project is out of date, Do you want to run pub get?", with an embedded button to run it. I did that and then the pubspec modification triggers started working again.
This notification wasn't appearing before, but I imagine this was preventing the triggers to even work at all.
Unfortunately this is just an assumption, as I wasn't able to view the logs while it was failing.
DanTup commentedon Dec 19, 2022
That's odd, I'm not sure what happened there. The prompt to run "pub get" should appear when you open a project if a few conditions are met - however VS Code hides notifications after around 10 seconds so it's possible if you don't spot it pop up, it can vanish and you won't see it (there is a dot on the notification bell in the status bar, but it's very subtle).
I'm also unsure why that would have preventing the on-save from running, they should be completely unrelated.
If you do see this again and are able to grab a log, please let me know and we can figure out what's up. In the meantime I'll close this as I don't think there's anything I can investigate.
Thanks!
davidmartos96 commentedon Dec 19, 2022
@DanTup Will do, thanks!
davidmartos96 commentedon Dec 20, 2022
@DanTup I was able to get the bug again.
The pubspec update is being skipped because it says that pub get is already running.
I've tried running pub get from the terminal and from the VSCode "Get packages" command. Both end successfully, but the changes in the pubspec will trigger
[General] [Info] Already running pub get, skipping!https://github.dev/Dart-Code/Dart-Code/blob/3071bd71cbb3c053e9e8cbb8cd75405b0bc44eb7/src/extension/commands/packages.ts#L199
DanTup commentedon Dec 20, 2022
Ah, thanks! I see what's happening. We set that flag as if we're running pub around the notification that appears in the bottom corner. So if you don't notice that notification (which VS code hides after ~10s), then it will be forever "locked" as already running, when in reality it didn't start.
[-]Automatic Packages Get on Pubspec change not working[/-][+]Automatic Packages Get on Pubspec change not working if prompt to run "pub get" at startup is ignored[/+]Don't block pub-get-on-save if the initial startup prompt is ignored