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

Feature request: show only tree that depends on regex #15

Open
wmertens opened this issue Feb 27, 2021 · 6 comments
Open

Feature request: show only tree that depends on regex #15

wmertens opened this issue Feb 27, 2021 · 6 comments
Labels
design-needed enhancement New feature or request

Comments

@wmertens
Copy link

I'd like to be able to see the packages that depend on e.g. Perl, and their parents.

Ideally, you'd be able to search for "perl", and then the tree makes it obvious which packages transitively and which directly depend on it. Perhaps just don't show the ones that don't depend?

@utdemir
Copy link
Owner

utdemir commented Feb 27, 2021

Here's how I'd do this right now:

  • nix-tree has already has a search functionality (shortcut s), so I'd use it to search the store path I'm looking for. But it's just a case-insensitive plain text search, so no fancy expressions there.
  • Store paths directly depend on it are on the bottom status bar, called Immediate Parents.
  • nix-tree also has a why-depends mode (shortcut w), and you can see the store path transitively depend on it there. You can even navigate to one of those, highlighting the part there on the main panes.

Does that work for you?

Otherwise, we can have something like a "focus mode", where a shortcut marks the current selected store path "focused"; then only its ancestors and descendents will be visible. Then probably pressing it again will remove the focus. It kind of make sense to me, but I'm afraid of adding too many confusing functionality to it. But please let me know if you prefer something like that, or if you have another suggestion.

@wmertens
Copy link
Author

Ok, plain search is fine, but I'd indeed like to have this focus mode 🙂
It's just really helpful to see things in a tree structure.

@utdemir
Copy link
Owner

utdemir commented Mar 1, 2021

Okay, I think this is a good idea. The implementation is going to be a bit tricky, because it affects many places. So I'll probably only start to look at it the next weekend.

@utdemir
Copy link
Owner

utdemir commented Mar 27, 2021

So, here's some bad news. I think the trivial way to implement this (hide everything which is not either an ancestor or descendent of the "focused" store path) won't be as nice.

Because, imagine having the focused path at the middle pane. You'd expect the left pane to contain the parents of that path, but the above approach does not do that (it'll only show the children of the previously selected grandparent).

I think the ideal would be flipping the dependency graph and apply the mechanism for the right panes to the left pane; so having all parents of the focused path on the left, and their parents on the left of the left and so on (it's hard to explain, sorry).

However, it is tricky to implement. Also it introduces a lot of design issues (what will the sizes mean in that case, how will why-depends/search will work). So, I don't think I'll be able to spend necessary time on it soon enough. However I will keep considering it and maybe we'll figure out a nice way to do this.

@wmertens
Copy link
Author

Ok, you know best :) although I don't understand the middle pane explanation. Won't you only see connected parts of the graph?

@utdemir
Copy link
Owner

utdemir commented Mar 28, 2021

So, let's think about this graph:

example graph

And say, you navigated to node e through root -> a -> b -> e. Your panes would look like this in the current state of nix-tree.

------------------
| [b] | [e] | f |
------------------

But, this does not mean that b is the only parent of e, it merely means that the previous pane contained only b.

I think, if you were to now use the hypothetical "focus" feature on e, you'd prefer to see something like:

-----------------
| [b] | [e] | f |
|  c  |     |   |
|  d  |     |   |
-----------------

This'd make it easier to see which packages depend on e, which I think is closer to what you want. However, implementing this is tricky (mostly UX-wise).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
design-needed enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants