Skip to content

"Add 'package' to dependencies" fix sometimes appears after "Ignore" actions #5968

Closed

Description

@FMorschel

See:

Image
Workspace Environment
Dart Code extension: 3.131.20260304
Flutter extension: 3.131.20260303 (activated)

App: Visual Studio Code
App Host: desktop
Version: win 1.110.1

Workspace type: Dart, Flutter (LSP)
Workspace name: workspace

Dart (3.12.0-178.0.dev): C:\Users\felip_0vh5fa6\.puro\shared\caches\91f22e12e3ad835ac2116b669e5d67507f28b2de\dart-sdk
Flutter (3.42.0-1.0.pre-307): C:\Users\felip_0vh5fa6\.puro\envs\master\flutter (No device)

Output from 'dart info'

C:\Users\felip_0vh5fa6\.puro\shared\caches\91f22e12e3ad835ac2116b669e5d67507f28b2de\dart-sdk\bin\dart.exe 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.12.0-178.0.dev (dev) (Mon Feb 23 20:04:27 2026 -0800) on "windows_x64"
  • on windows / "Windows 11 Pro" 10.0 (Build 26200)
  • locale is pt-BR

Project info

  • sdk constraint: '^3.9.0'
  • dependencies:
  • dev_dependencies: flutter_lints

Process info

Memory CPU Elapsed time Command line
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dartvm.exe
Output from 'flutter doctor'

C:\Users\felip_0vh5fa6\.puro\envs\master\flutter\bin\flutter.bat doctor -v

[!] Flutter (Channel [user-branch], 3.42.0-1.0.pre-307, on Microsoft Windows [Version 10.0.26200.7840], locale pt-BR) [2,8s]
    ! Flutter version 3.42.0-1.0.pre-307 on channel [user-branch] at C:\Users\felip_0vh5fa6\.puro\envs\master\flutter
      Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
      If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
    ! Warning: `flutter` on your path resolves to C:\Users\felip_0vh5fa6\.puro\envs\stable\flutter\bin\flutter, which is not inside your current Flutter SDK checkout at C:\Users\felip_0vh5fa6\.puro\envs\master\flutter. Consider adding C:\Users\felip_0vh5fa6\.puro\envs\master\flutter\bin to the front of your path.
    ! Warning: `dart` on your path resolves to C:\Users\felip_0vh5fa6\dart\bin\dart.exe, which is not inside your current Flutter SDK checkout at C:\Users\felip_0vh5fa6\.puro\envs\master\flutter. Consider adding C:\Users\felip_0vh5fa6\.puro\envs\master\flutter\bin to the front of your path.
    ! Unknown upstream repository.
      Reinstall Flutter by following instructions at https://flutter.dev/setup.
    • Framework revision 91f22e12e3 (11 days ago), 2026-02-27 14:30:46 +1300
    • Engine revision 91f22e12e3
    • Dart version 3.12.0 (build 3.12.0-178.0.dev)
    • DevTools version 2.55.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations, enable-native-assets, omit-legacy-version-file, enable-lldb-debugging, enable-uiscene-migration, enable-riscv64
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.

[√] Windows Version (11 Pro 64-bit, 25H2, 2009) [9,6s]

[√] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [11,8s]
    • Android SDK at C:\Users\felip_0vh5fa6\AppData\Local\Android\sdk
    • Emulator version 36.4.9.0 (build_id 14788078) (CL:N/A)
    • Platform android-36.1, build-tools 36.1.0
    • Java binary at: C:\Users\felip_0vh5fa6\AppData\Local\Programs\Android Studio 2\jbr\bin\java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment (build 21.0.6+-13368085-b895.109)
    • All Android licenses accepted.

[√] Chrome - develop for the web [453ms]
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.14.20) [449ms]
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.14.36705.20
    • Windows 10 SDK version 10.0.26100.0

[√] Connected device (3 available) [1.390ms]
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.26200.7840]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 143.0.7499.193
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 145.0.3800.82

[√] Network resources [1.153ms]
    • All expected network resources are available.

! Doctor found issues in 1 category.

Activity

  1. added this to the v3.132.0 milestone on Mar 9, 2026
  2. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    in editorRelates to code editing or language features
    on Mar 9, 2026
  3. FMorschel commented on May 7, 2026

    @FMorschel
    ContributorAuthor

    Hey @DanTup

    I'm on v3.135.20260430 (pre-release), and I'm still seeing this:

    Image
  4. DanTup commented on May 7, 2026

    @DanTup
    Member

    Weird, will take another look.

  5. reopened this on May 7, 2026
  6. modified the milestones: v3.132.0, v3.136.0 on May 7, 2026
  7. DanTup commented on May 14, 2026

    @DanTup
    Member

    Odd, I can't repro:

    Image

    Although VS Code doesn't really define how these are sorted when they come from different providers (eg. LSP vs the extension). I had previously tried to make sure we register the extension one after the LSP server is up and running (since last seems to come first).

    Can you reliably reproduce this? If so, could you try running Dart-Code from source with d8373c8 to see if that makes any difference?

  8. FMorschel commented on May 15, 2026

    @FMorschel
    ContributorAuthor

    Yes, I still reproduce it on my work machine, even with your commit:

    Image

    I've tested with both Dart stable and beta, and no changes there either. Can I debug anything for this?

  9. DanTup commented on May 15, 2026

    @DanTup
    Member

    Can I debug anything for this?

    it's a bit of a faff, but if you make AddDependencyCodeActionProvider take an optional extra string in the constructor, and then append that string to the title of the codeactions it produces, and then change the code to register two copies of it:

    const addDependencyCodeActionProvider = new AddDependencyCodeActionProvider(DART_MODE, "first registered");
    context.subscriptions.push(vs.languages.registerCodeActionsProvider([...DART_MODE], addDependencyCodeActionProvider, addDependencyCodeActionProvider.metadata));
    
    const addDependencyCodeActionProvider2 = new AddDependencyCodeActionProvider(DART_MODE, "second registered");
    context.subscriptions.push(vs.languages.registerCodeActionsProvider([...DART_MODE], addDependencyCodeActionProvider2, addDependencyCodeActionProvider2.metadata));

    It would be interesting to know what order they show up for you in, and whether it seems consistent.

    If that's different to mine, I will dig out where the sorting happens in VS Code again and see if I can figure out what's going on.

  10. FMorschel commented on May 15, 2026

    @FMorschel
    ContributorAuthor

    Like so?

    Image Image
  11. DanTup commented on May 15, 2026

    @DanTup
    Member

    Yep, that's what I meant - and it seems like the last one did win. So why it doesn't win the LSP one, I don't know.

    Could you try wrapping those registrations in a timeout so they are done after a long period (eg. 10s):

    setTimeout(function() {
    // registrations
    }, 10000);
    

    And see if that puts them at the top?

    If not, I'll find the VS Code sorting code - or, possible we could inject these in the middleware instead of using a separate provider. That way we don't need to rely on how VS Code orders between two providers, we just need to require it to preserve the "servers" order (which it does).

  12. FMorschel commented on May 15, 2026

    @FMorschel
    ContributorAuthor

    That seems to work:

    Image
  13. DanTup commented on May 26, 2026

    @DanTup
    Member

    Thanks - that does seem to suggest the order matters, but doesn't explain why we were not already always behind VS Code. I'll see if I can figure out why that's not deterministic, and if not, try switching to injecting them with middleware so there's only one provider involved.

  14. DanTup commented on May 26, 2026

    @DanTup
    Member

    Ah, looks like the VS Code client registers its provider lazily as a response to the dynamic registrations from the server. So there is a race between this and analysis.

    I'm moving it to the middleware.

  15. changed the title [-]`Add 'package' to dependencies` should be before `Ignore` fixes[/-] [+]"Add 'package' to dependencies" fix sometimes appears after "Ignore" actions[/+] on May 26, 2026
  16. DanTup commented on May 26, 2026

    @DanTup
    Member

    @FMorschel I pushed a fix for this - I'm fairly sure it'll be deterministic, but if you want to pull the latest code you could test that it is working for you.

  17. FMorschel commented on May 26, 2026

    @FMorschel
    ContributorAuthor

    Yes, it worked! Thanks a lot!

  18. DanTup commented on May 26, 2026

    @DanTup
    Member

    Great, thanks for testing!

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 editorRelates to code editing or language featuresis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions