Skip to content

Add dependency chain to Dependencies toolwindow #3095

Closed

Description

@timsneath

Is your feature request related to a problem? Please describe.
I'm often curious to know why a dependency is listed. Often something is brought in transitively and I can't figure out why. Particularly when developing a package, my goal is to keep the number of dependencies low to avoid version resolution hell and keep the package lightweight.

Describe the solution you'd like
A tooltip that shows the breadcrumb trail(s) that leads to a dependency. (e.g. "ffi -> intl -> characters"), that shows why a package is brought in.

Describe alternatives you've considered
The dependency graph could be hierarchical, starting with the packages that are explicitly mentioned in dependencies and dev_dependencies; those could include their children (although are there problems with circular references?)

Additional context
image

Don't know if this is even feasible; just random musings.

Activity

  1. added
    is enhancementAn enhancement or improvement that should be listed in release notes but is not a bug fix.
    on Jan 24, 2021
  2. DanTup commented on Jan 25, 2021

    @DanTup
    Member

    @jonasfj it looks like I can't easily get this info from package_config.json directly (it's just a flat list), although I found the command pub deps. Is there a way to get the same data in a more structured format to avoid trying to parse those in case they change?

    @timsneath

    The dependency graph could be hierarchical, starting with the packages that are explicitly mentioned in dependencies and dev_dependencies; those could include their children (although are there problems with circular references?)

    Can there be circular references in packages? It probably wouldn't pose a problem, as the tree is lazy (so you could perhaps expand it forever, but it wouldn't stop the tree rendering further up), although we could probably detect it and not allow you to walk through a package if it was already in the current chain further up.

    That said - expanding the tree nodes all the way down might be a bit tedious and if you're trying to find out why you have package_foo in your dependencies, this seems like it might be the wrong way around (you'd need to follow the tree from the top to find out where it's a branch). Perhaps a context menu entry that just does something similar to pub deps but filtered to where the package you picked is a leaf would be most useful?

  3. added this to the On Deck milestone on Jan 25, 2021
  4. timsneath commented on Jan 25, 2021

    @timsneath
    ContributorAuthor

    I suspect there could be circular references, yes. I'm not certain what the right UI is here, although it feels very similar to walking a class inheritance path conceptually. Perhaps there is prior IDE art we can look to for inspiration?

  5. DanTup commented on Feb 23, 2021

    @DanTup
    Member

    @jonasfj ping! :) Do you have any thoughts on the above?

    it looks like I can't easily get this info from package_config.json directly (it's just a flat list), although I found the command pub deps. Is there a way to get the same data in a more structured format to avoid trying to parse those in case they change?

  6. jonasfj commented on Feb 23, 2021

    @jonasfj

    Can there be circular references in packages?

    Circular dependencies is definitely a thing.. rare but it happens...

    I think we could easily add a JSON output to dart pub deps, this is not currently available.

    The alternative is to parse pub specs, they are easy to find with the information from package_config.json.

    But I don't think JSON output for dart pub deps is controversial, filed: dart-lang/pub#2892

  7. added
    in viewsRelates to custom views, like the Test tree or Dependencies tree
    on Mar 8, 2021
  8. modified the milestones: On Deck, v3.24.0 on May 25, 2021
  9. DanTup commented on Jun 28, 2021

    @DanTup
    Member

    Tooltips now show (the first of, if multiple) the shortest path to a dependency:

    Screenshot 2021-06-28 at 12 58 37

    We should show all paths if required, but I thought it might get a bit noisy (and would be a little more computation, since we currently bail out when visiting packages we've already seen). Feedback welcome!

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 viewsRelates to custom views, like the Test tree or Dependencies treeis 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