Skip to content

Add Dependency selects the first entry with one more package even if you only wrote a whitespace after the last one #5952

Closed

Description

@FMorschel

Describe the bug
Writing a whitespace after the last dependency selects the first entry with two dependencies to add.

To Reproduce
Steps to reproduce the behavior:

  1. Open a dart pub package
  2. Use the Dart: Add Dependency or Dart: Add Dev Dependency
  3. Write down analyzer (for example) and a whitespace after it.
  4. See it selects the first entry with analyzer dio.

Expected behavior
For it to select only analyzer.

Screenshots

Image

Please complete the following information:

Workspace Environment
Dart Code extension: 3.129.20260226
Flutter extension: 3.129.20260202 (activated)

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

Workspace type: Dart, Flutter (LSP) (Multiroot)
Workspace name: vendas (Workspace)

Dart (3.11.0): C:\Users\felip_0vh5fa6\.puro\shared\caches\6c0baaebf70e0148f485f27d5616b3d3382da7bf\dart-sdk
Flutter (3.41.2): C:\Users\felip_0vh5fa6\.puro\envs\stable\flutter (SM G780F (wireless) (android-arm64/android))

Output from 'dart info'

C:\Users\felip_0vh5fa6\.puro\shared\caches\6c0baaebf70e0148f485f27d5616b3d3382da7bf\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.11.0 (stable) (Mon Feb 9 00:38:07 2026 -0800) on "windows_x64"
  • on windows / "Windows 11 Pro" 10.0 (Build 26200)
  • locale is pt-BR

Project info

  • sdk constraint: '^3.10.0'
  • dependencies: async, bloc, brasil_fields, cached_network_image, cloud_firestore, collection, community_charts_flutter, connectivity_plus, convex_bottom_bar, cross_file, currency_text_input_formatter, dartz, device_info_plus, dio, dio_http_cache, direct_select, due_date, equatable, firebase_auth, firebase_core, flutter, flutter_custom_clippers, flutter_easyloading, flutter_keyboard_visibility, flutter_localizations, flutter_signature_pad, flutter_speed_dial, flutter_spinbox, flutter_staggered_grid_view, font_awesome_flutter, grouped_list, image, intl, location, logging, mailer, mask_text_input_formatter, material_design_icons_flutter, package_info_plus, path, path_provider, pdf, percent_indicator, provider, scoped_model, search_cep, share_plus, shared_preferences, sqflite, syncfusion_flutter_datepicker, syncfusion_localizations, time, tutorial_coach_mark, upgrader, url_launcher, validators, wakelock_plus, xml
  • dev_dependencies:
  • elided dependencies: 10

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 -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dart.exe
0 MB -- dartvm.exe
0 MB -- dartvm.exe
0 MB -- dartvm.exe
Output from 'flutter doctor'

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

[!] Flutter (Channel stable, 3.41.2, on Microsoft Windows [Version 10.0.26200.7840], locale pt-BR) [1.300ms]
    • Flutter version 3.41.2 on channel stable at C:\Users\felip_0vh5fa6\.puro\envs\stable\flutter
    ! 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\stable\flutter. Consider adding C:\Users\felip_0vh5fa6\.puro\envs\stable\flutter\bin to the front of your path.
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 90673a4eef (12 days ago), 2026-02-18 13:54:59 -0800
    • Engine revision 6c0baaebf7
    • Dart version 3.11.0
    • DevTools version 2.54.1
    • 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
    • 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) [6,2s]

[√] Android toolchain - develop for Android devices (Android SDK version 36.1.0) [8,1s]
    • 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 [393ms]
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.14.20) [391ms]
    • 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 (4 available) [913ms]
    • SM G780F (wireless) (mobile) • adb-RX8R30G5WDH-h0vKcv._adb-tls-connect._tcp • android-arm64  • Android 13 (API 33)
    • 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.050ms]
    • All expected network resources are available.

! Doctor found issues in 1 category.

Activity

  1. added this to the v3.132.0 milestone on Mar 3, 2026
  2. added
    in commandsRelates to commands (usually invoked from the command Palette)
    on Mar 3, 2026
  3. DanTup commented on Mar 23, 2026

    @DanTup
    Member

    Unfortunately it seems that we can't fix this. Even if I insert an item that matches the package name with a space following it, VS Code sorts it to the bottom of the list, so you'd still get the top one if you press <enter> 🙁

    add_dep_space.mp4
  4. modified the milestones: v3.132.0, Backlog on Mar 23, 2026
  5. FMorschel commented on Mar 23, 2026

    @FMorschel
    ContributorAuthor

    Could we add the other suggestions only if we write letters?

  6. modified the milestones: Backlog, v3.134.0 on Apr 14, 2026
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)is bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions