Skip to content

Automatic Packages Get on Pubspec change not working if prompt to run "pub get" at startup is ignored #4307

Closed

Description

@davidmartos96

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.

To Reproduce
Steps to reproduce the behavior:

  1. Edit pubspec.yaml
  2. Packages get is not run.

Expected behavior
Packages get should run

Please complete the following information:

  • Operating System and version: Fedora 37
  • VS Code version: 1.74.1
  • Dart extension version: 3.55.20221130
  • Dart/Flutter SDK version: 3.55.20221129

Activity

  1. DanTup commented on Dec 18, 2022

    @DanTup
    Member

    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.

    Please let me know what you find!

  2. added
    awaiting infoRequires more information from the customer to progress
    on Dec 18, 2022
  3. davidmartos96 commented on Dec 19, 2022

    @davidmartos96
    ContributorAuthor

    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.

  4. DanTup commented on Dec 19, 2022

    @DanTup
    Member

    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!

  5. removed
    awaiting infoRequires more information from the customer to progress
    on Dec 19, 2022
  6. davidmartos96 commented on Dec 19, 2022

    @davidmartos96
    ContributorAuthor

    @DanTup Will do, thanks!

  7. davidmartos96 commented on Dec 20, 2022

    @davidmartos96
    ContributorAuthor

    @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

  8. DanTup commented on Dec 20, 2022

    @DanTup
    Member

    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.

  9. reopened this on Dec 20, 2022
  10. added this to the v3.58.0 milestone on Dec 20, 2022
  11. 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
  12. added a commit that references this issue on Sep 2, 2025
    8b5715b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions