Skip to content

Automatically selecting a project to add a dependency to from the open file is not obvious, should instead show a pick-list with it pre-selected #5502

Closed

Description

@dhutaryan

Describe the bug
I have a packages folder with some flutter and dart packages. When I try to add a new dependency I can't select where I want to add this dependency (see example on the attached screenshot).

Expected behavior
To have a choice where I can add a new dependency as on the screenshot

Screenshots

Image

Please complete the following information:

You can run the Dart: Collect Diagnostic Information command from the VS Code command palette (F1) to easily capture this information or provide it manually.

  • macOS 13.5.1
  • VS Code version: 1.99.3
  • Dart extension version: 3.110.0
  • Dart/Flutter SDK version: 3.7.2/3.29.3
  • Target device (if the issue relates to Flutter debugging): -

Activity

  1. DanTup commented on May 6, 2025

    @DanTup
    Member

    @dhutaryan I'm not sure I understand - isn't the screenshot showing that you can select a location?

    Or is this not your screenshot?

    Assuming not, can you confirm how you're adding the dependency - are you invoking the "Add Dependency" command from the palette? What happens when you invoke it?

  2. added
    awaiting infoRequires more information from the customer to progress
    on May 6, 2025
  3. DanTup commented on May 6, 2025

    @DanTup
    Member

    One thing to note that may or may not be related, is that the "Add Dependency" command will automatically select the project of the active file if there is one. It assumes (possibly incorrectly) that you want to add the dependency to the package for the file you're working in.

  4. dhutaryan commented on May 6, 2025

    @dhutaryan
    Author

    @dhutaryan I'm not sure I understand - isn't the screenshot showing that you can select a location?

    Or is this not your screenshot?

    screenshot is expected result

    Assuming not, can you confirm how you're adding the dependency - are you invoking the "Add Dependency" command from the palette? What happens when you invoke it?

    yes, from the palette. I can add dependency in the root project only. Extension doesn't provide me to select the package.

    Interesting thing. Everything has worked as expected after I initialized git for the project.

  5. DanTup commented on May 6, 2025

    @DanTup
    Member

    @dhutaryan could it be what I mentioned above - that it automatically selected the project for the current active/open file?

  6. dhutaryan commented on May 6, 2025

    @dhutaryan
    Author

    Seems yes. It automatically selects the project for which the file is opened.

  7. DanTup commented on May 6, 2025

    @DanTup
    Member

    I wonder if we should change this so instead of asking for a single project, we show a checkbox-list for all projects, and just pre-tick the current project (and ofc if there is only one project, we can skip the prompt). That way you only have to press <enter> once more to get the current behaviour, but you can also easily add it to multiple (or different) projects fairly easy?

  8. dhutaryan commented on May 7, 2025

    @dhutaryan
    Author

    I have no idea :) I thought it didn't work at all. Probably, your option makes sense.

  9. added this to the v3.114.0 milestone on May 27, 2025
  10. removed
    awaiting infoRequires more information from the customer to progress
    on May 27, 2025
  11. changed the title [-]There are no choice to select a package when install a new dependency[/-] [+]Automatically selecting a project to add a dependency to from the open file is not obvious, should instead show a pick-list with it pre-selected[/+] on May 27, 2025
  12. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    in commandsRelates to commands (usually invoked from the command Palette)
    and removed on May 27, 2025
  13. DanTup commented on Jun 9, 2025

    @DanTup
    Member

    Now if there is more than one project, we'll always show the project selector with the project for the active file pre-selected. You can just hit <enter> to accept this (which gives the same behaviour as before), or you can change which package it gets added to.

    Image

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 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