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

Show list items name along with their index #12

Open
nicolas-goudry opened this issue Apr 12, 2024 · 4 comments
Open

Show list items name along with their index #12

nicolas-goudry opened this issue Apr 12, 2024 · 4 comments

Comments

@nicolas-goudry
Copy link

Basically, if a list is a:

  • list of strings
  • list of attrset with a name attribute

It would be great to get the string along with the item index.

I’m asking for this because currently in order to browse the environment.systemPackages I need to enter each item and scroll to the name attribute to know what it is.

Thanks!

@bluskript
Copy link
Owner

value previews for lists and attrsets are tricky, because Nix is lazy and just getting the type for one element can take a long time, which prevents us from evaluating anything else until its done. It might be possible to look at the options definitions instead of the config definition itself to get types and would be much faster, but even so expanding every package attrset might take a while.

@nicolas-goudry
Copy link
Author

I see what you mean for the attrsets, but for the list of strings shouldn’t it be easy?

Regarding the attrset, would it be possible to lazy load the name attribute when the list is rendered to avoid blocking the view for too long?

@bluskript
Copy link
Owner

I think list of primitives could work, but for attrsets accessing any sub-attribute requires the parent attrset to be evaluated at least, unfortunately.

@nicolas-goudry
Copy link
Author

What about an opt-in key to « force load attrset names »? This way, users are aware of the cost of this action but still get the feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants