Repository navigation
"Add 'package' to dependencies" fix sometimes appears after "Ignore" actions #5968
Copy link
Copy link
Closed
Labels
in editorRelates to code editing or language featuresRelates to code editing or language featuresis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.An enhancement or improvement that should be listed in release notes but is not a bug fix.
Milestone
Description
See:
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.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
in editorRelates to code editing or language featuresRelates to code editing or language featuresis enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.An enhancement or improvement that should be listed in release notes but is not a bug fix.
Activity
FMorschel commentedon May 7, 2026
Hey @DanTup
I'm on
v3.135.20260430 (pre-release), and I'm still seeing this:DanTup commentedon May 7, 2026
Weird, will take another look.
Delay registration of "Add Dependency" code action provider further
DanTup commentedon May 14, 2026
Odd, I can't repro:
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?
FMorschel commentedon May 15, 2026
Yes, I still reproduce it on my work machine, even with your commit:
I've tested with both Dart stable and beta, and no changes there either. Can I debug anything for this?
DanTup commentedon May 15, 2026
it's a bit of a faff, but if you make
AddDependencyCodeActionProvidertake 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: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.
FMorschel commentedon May 15, 2026
Like so?
DanTup commentedon May 15, 2026
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):
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).
FMorschel commentedon May 15, 2026
That seems to work:
DanTup commentedon May 26, 2026
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.
DanTup commentedon May 26, 2026
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.
[-]`Add 'package' to dependencies` should be before `Ignore` fixes[/-][+]"Add 'package' to dependencies" fix sometimes appears after "Ignore" actions[/+]DanTup commentedon May 26, 2026
@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.
FMorschel commentedon May 26, 2026
Yes, it worked! Thanks a lot!
DanTup commentedon May 26, 2026
Great, thanks for testing!
Move the "Add Dependency" fix to middleware