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
def apply(x: Any, width: Int = defaultWidth, height: Int = defaultHeight, indent: Int = defaultIndent, initialOffset: Int = 0): fansi.Str =
My usage is that i have case classes with some junk fields (even binary data). When printing them, i'd rather pprint truncate the field so it doesn't use up the vertical space.
I see that output can be shortened by restricting the number of lines, i'd like it to also be shortened by the number of collumns
The text was updated successfully, but these errors were encountered:
Seems plausible; we'd need some way to tell PPrint which fields to truncate and which to wrap, since I assume you don't want to just truncate everything (which is doable with width = 99999 and String#take).
Perhaps we could provide an annotation that the case classes could use, use java-reflection to perform this task on Scala-JVM, and just not support it on Scala-JS? Or we could provide a trait you inherit to disable wrapping for a particular type, but that won't work for fields of a type you don't control
Actually for now for my use, truncating everything would do just fine. But I do agree that generally this is a too inflexible approach.
So, wrt truncating only some fileds : I'd prefer something that could work at pprint's call site, rather than having to reference pprint in my unrelated type definitions.
That would involve designating some fields or some field types to be width-truncated via reflection.
This designation could happen at every call or by configuration (I see pprint has a configuration parameter already).
Does this sound to silly a usage?
I can imagine that my preference above could change pprint's interface too much (also, rather clumsy) so an annotation-based implementation is also fine by me; surely I can't comprehend all the tread-offs involved just yet.
def apply(x: Any, width: Int = defaultWidth, height: Int = defaultHeight, indent: Int = defaultIndent, initialOffset: Int = 0): fansi.Str =
My usage is that i have case classes with some junk fields (even binary data). When printing them, i'd rather pprint truncate the field so it doesn't use up the vertical space.
I see that output can be shortened by restricting the number of lines, i'd like it to also be shortened by the number of collumns
The text was updated successfully, but these errors were encountered: