You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add dependency chain to Dependencies toolwindow #3095
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
Don't know if this is even feasible; just random musings.
@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?
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?
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?
@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?
Tooltips now show (the first of, if multiple) the shortest path to a dependency:
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!
Activity
DanTup commentedon Jan 25, 2021
@jonasfj it looks like I can't easily get this info from
package_config.jsondirectly (it's just a flat list), although I found the commandpub 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
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_fooin 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 topub depsbut filtered to where the package you picked is a leaf would be most useful?timsneath commentedon Jan 25, 2021
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 commentedon Feb 23, 2021
@jonasfj ping! :) Do you have any thoughts on the above?
jonasfj commentedon Feb 23, 2021
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 depsis controversial, filed: dart-lang/pub#2892DanTup commentedon Jun 28, 2021
Tooltips now show (the first of, if multiple) the shortest path to a dependency:
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!