Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dependency chain to Dependencies toolwindow #3095

Closed
timsneath opened this issue Jan 24, 2021 · 5 comments
Closed

Add dependency chain to Dependencies toolwindow #3095

timsneath opened this issue Jan 24, 2021 · 5 comments
Labels
in views Relates to custom views, like the Test tree or Dependencies tree is enhancement
Milestone

Comments

@timsneath
Copy link
Contributor

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.

@DanTup
Copy link
Member

DanTup commented Jan 25, 2021

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

@DanTup DanTup added this to the On Deck milestone Jan 25, 2021
@timsneath
Copy link
Contributor Author

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?

@DanTup
Copy link
Member

DanTup commented Feb 23, 2021

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

@jonasfj
Copy link

jonasfj commented Feb 23, 2021

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

@DanTup DanTup added the blocked on dart / flutter Requires a change in Dart or Flutter to progress label Mar 8, 2021
@DanTup DanTup added the in views Relates to custom views, like the Test tree or Dependencies tree label Mar 15, 2021
@DanTup DanTup modified the milestones: On Deck, v3.24.0 May 25, 2021
@DanTup DanTup removed the blocked on dart / flutter Requires a change in Dart or Flutter to progress label May 25, 2021
@DanTup DanTup closed this as completed in 4dc7d01 Jun 28, 2021
@DanTup
Copy link
Member

DanTup commented Jun 28, 2021

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
Labels
in views Relates to custom views, like the Test tree or Dependencies tree is enhancement
Projects
None yet
Development

No branches or pull requests

3 participants