Skip to content

Modifying a pubspec in a template project triggers pub get #5192

Closed

Description

@lishaduck

Describe the bug

#4581 seems to have regressed.

To Reproduce
Steps to reproduce the behavior:

  1. Clone https://github.com/lishaduck/bricks
  2. Open it in VS Code
  3. Watch the Flutter extension complain about invalid packages*
  4. Alternatively, open a file and notice that it's all red

Admittingly, I can't reproduce this this morning, but I could yesterday evening.

Expected behavior

It should ignore everything below __brick__.
Ideally for all diagnostics, but at least for pub get

Screenshots

Screenshot 2024-07-20 at 12 03 03 PM

Please complete the following information:

Workspace Environment
Dart Code extension: 3.92.0
Flutter extension: 3.92.0 (activated)

App: Visual Studio Code
App Host: desktop
Version: mac 1.91.1

Workspace type: Dart, Flutter (LSP)

Dart (3.4.1): /opt/homebrew/Caskroom/flutter/3.19.5/flutter/bin/cache/dart-sdk
Flutter (3.22.1): /opt/homebrew/Caskroom/flutter/3.19.5/flutter (No device)

Output from 'dart info'

/opt/homebrew/Caskroom/flutter/3.19.5/flutter/bin/cache/dart-sdk/bin/dart info

If providing this information as part of reporting a bug, please review the information
below to ensure it only contains things you're comfortable posting publicly.

General info

  • Dart 3.4.1 (stable) (Tue May 21 15:46:25 2024 +0000) on "macos_arm64"
  • on macos / Version 14.5 (Build 23F79)
  • locale is en-US

Process info

Memory CPU Elapsed time Command line
5 MB 0.0% 10:13 dart devtools --machine --allow-embedding --dtd-uri ws:/RE2IxKG1emQrYGRC
1 MB 0.0% 13:39:16 dart devtools --machine --allow-embedding --dtd-uri ws:/iUbYR1oXEr31RwiS
6 MB 0.0% 03:08 dart devtools --machine --allow-embedding --dtd-uri ws:/qaAfcfjoxp85fOMt
1 MB 0.0% 13:28:14 dart devtools --machine --allow-embedding --dtd-uri ws:/vDf2hcUpeJ8ILqrD
10 MB 0.0% 10:48 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.92.0
9 MB 0.0% 10:23 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.92.0
14 MB 0.0% 03:09 dart language-server --protocol=lsp --client-id=VS-Code --client-version=3.92.0
7 MB 0.0% 09:25 dart lib/custom_lint_client.dart ::1 51943
1 MB 0.0% 14:01:21 dart tooling-daemon --machine
1 MB 0.0% 13:39:17 dart tooling-daemon --machine
1 MB 0.0% 13:28:21 dart tooling-daemon --machine
5 MB 0.0% 10:48 dart tooling-daemon --machine
5 MB 0.0% 10:23 dart tooling-daemon --machine
6 MB 0.0% 03:09 dart tooling-daemon --machine
18 MB 0.0% 13:39:17 flutter_tools.snapshot daemon
0 MB 87.6% 13:28:21 flutter_tools.snapshot daemon
0 MB 0.0% 13:05:00 flutter_tools.snapshot daemon
24 MB 0.0% 10:23 flutter_tools.snapshot daemon
22 MB 0.0% 03:09 flutter_tools.snapshot daemon
Output from 'flutter doctor'

/opt/homebrew/Caskroom/flutter/3.19.5/flutter/bin/flutter doctor -v

[✓] Flutter (Channel stable, 3.22.1, on macOS 14.5 23F79 darwin-arm64, locale en-US)
    • Flutter version 3.22.1 on channel stable at /opt/homebrew/Caskroom/flutter/3.19.5/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision a14f74ff3a (8 weeks ago), 2024-05-22 11:08:21 -0500
    • Engine revision 55eae6864b
    • Dart version 3.4.1
    • DevTools version 2.34.3

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at /Users/dukese01/Library/Android/sdk
    • Platform android-34, build-tools 34.0.0
    • ANDROID_HOME = /Users/dukese01/Library/Android/sdk
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 15.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15E204a
    • CocoaPods version 1.15.2

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)

[✓] IntelliJ IDEA Ultimate Edition (version 2024.1.4)
    • IntelliJ at /Users/dukese01/Applications/IntelliJ IDEA Ultimate.app
    • Flutter plugin version 80.0.2
    • Dart plugin version 241.17890.8

[✓] VS Code (version 1.90.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.92.0

[✓] VS Code (version 1.91.1)
    • VS Code at /Users/dukese01/Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.92.0

[✓] Connected device (3 available)
    • macOS (desktop)                 • macos                 • darwin-arm64   • macOS 14.5 23F79 darwin-arm64
    • Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin         • macOS 14.5 23F79 darwin-arm64
    • Chrome (web)                    • chrome                • web-javascript • Google Chrome 126.0.6478.183

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Activity

  1. lishaduck commented on Jul 22, 2024

    @lishaduck
    Author
  2. lishaduck commented on Jul 22, 2024

    @lishaduck
    Author

    I was able to reproduce it. It seems to be after rebases, it still tries to pub get.
    Presumably it doesn't know about the rebase, so, without knowing anything about the internals, I'd assume it's only filtering changes from the vscode file watcher, but changes made in the terminal aren't filtered for some reason.

    Pictures:
    Screenshot 2024-07-21 at 9 59 40 PM
    Screenshot 2024-07-21 at 9 59 44 PM

  3. DanTup commented on Jul 22, 2024

    @DanTup
    Member

    Thanks for the info! I think the problem is that there's a code path here that can trigger a pub get even if the folder had been filtered out from the list.

    else if (!forcePrompt && projectsRequiringPub.length === 0 && uri)
    await this.runPubGetWithRelatives(projectFolders, uri);

    This needs a little refactoring so that the filter always applies, regardless of the pub status. There's some other refactoring going on here (to support pub workspaces) so I'll look at sorting this after that's done.

  4. added this to the v3.94.0 milestone on Jul 22, 2024
  5. added
    in editorRelates to code editing or language features
    in commandsRelates to commands (usually invoked from the command Palette)
    on Jul 22, 2024
  6. changed the title [-]Runs 'pub get' in Mason Projects[/-] [+]Modifying a pubspec in a template project triggers `pub get`[/+] on Jul 22, 2024
  7. lishaduck commented on Jul 22, 2024

    @lishaduck
    Author

    Thanks for the info! I think the problem is that there's a code path here that can trigger a pub get even if the folder had been filtered out from the list.

    else if (!forcePrompt && projectsRequiringPub.length === 0 && uri)
    await this.runPubGetWithRelatives(projectFolders, uri);

    This needs a little refactoring so that the filter always applies, regardless of the pub status. There's some other refactoring going on here (to support pub workspaces) so I'll look at sorting this after that's done.

    Thanks!

  8. lishaduck commented on Jul 23, 2024

    @lishaduck
    Author

    Thanks at ton!

  9. DanTup commented on Jul 23, 2024

    @DanTup
    Member

    np! Please let me know if you see this again. The fix is already in the pre-release version if you want to switch to that and verify it's completely solved.

    Dart pre-release versions

  10. DanTup commented on Sep 12, 2024

    @DanTup
    Member

    I'd assume it's only filtering changes from the vscode file watcher, but changes made in the terminal aren't filtered for some reason

    From a quick glance at the code, the filtering is done just before we invoke the command, so we should either filter it out or we wouldn't call the command. I wonder if there's another code path somewhere that's triggering it.

    Do you have steps that reliably reproduce it that I can debug with?

  11. lishaduck commented on Sep 12, 2024

    @lishaduck
    Author

    Oh, I'm sorry 🤣

    I hit the wrong button in my terminal, and it resent that message. I blame fuzzy searching.
    It said it failed, so I ignored it, but I guess it didn't? 🤷‍♂️

  12. DanTup commented on Sep 12, 2024

    @DanTup
    Member

    oh lol, I didn't notice it was a duplicate of the previous message. Thanks for clarifying 😄

  13. lishaduck commented on Sep 24, 2024

    @lishaduck
    Author
  14. lishaduck commented on Sep 24, 2024

    @lishaduck
    Author

    lol, did it again. I need to figure out how to delete this 🤣

  15. DanTup commented on Sep 25, 2024

    @DanTup
    Member

    lol. I can try locking this issue which probably would cause any attempts to post comments to it to fail. If the issue comes back, you can just open a new issue instead.

  16. locked as resolved and limited conversation to collaborators on Sep 25, 2024
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

    in commandsRelates to commands (usually invoked from the command Palette)in editorRelates to code editing or language featuresis bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions