Show list items name along with their index
Basically, if a list is a:
- list of strings
- list of attrset with a
nameattribute
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!
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.
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?
I think list of primitives could work, but for attrsets accessing any sub-attribute requires the parent attrset to be evaluated at least, unfortunately.
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.