k0kubun/pp

Bug?: Colorize map field names/keys using "FieldName" color scheme setting

jalavosus opened this issue · 3 comments

Currently, both keys and values for map types are output using the color scheme setting for "String". It would likely make a bit more sense to have field names be colorized using the "FieldName" setting.

FieldName is for structs. I don't say "field" to refer to a key of a map. First of all, the keys of maps are not necessarily "String"; they could be any type. So it makes sense to visualize what's the type of map keys by using the color for those types.

It would be nice to have this as a ColorScheme config option or something, is all I'm saying. At the moment, I can't find a way to not have pp output struct names (which, for my use case, are entirely irrelevant), so being able to set the color scheme for map keys (regardless of underlying type) would be a genuinely useful feature.

I can't find a way to not have pp output struct names

Please use pp:"-" #49. Even if we didn't have the feature, converting a struct to a map and forcing key colors don't seem like a sensible way to approach it to me.