[Suggestion] When diffing, printing only what has changed #11
Replies: 1 comment 1 reply
-
@tgrapperon Thanks for starting the discussion! We actually tried this out, but in practice felt that it omitted too much context. We are trying to optimize for readability, and thought it can be helpful to know a bit more about the structure that changed than just the change itself. In the example above, we can see that the 0-indexed landmark was unfavorited, but we'd have to do some digging to figure out which landmark that was, like if we wanted to know its ID or name, which are readily available in the other version. In our experience structs usually don't grow too, too big, and so the extra lines of context haven't really "gotten in the way" yet. If you hit a point where you have a struct with 20 fields that may already be a sign that some of these fields could be grouped into their own types. One thing about your diff that does stand out is the long description string. We automatically truncate unchanged multi-line strings, but we should probably also truncate strings that exceed a certain character count. I'll take a stab at that later today! |
Beta Was this translation helpful? Give feedback.
-
Hello,
I haven't looked seriously at the code yet, so I don't know if the following feature is easily achievable.
When the type has many fields, printing the difference between two values/instances can still generate a lot of text, even if the changes are minimal. Collections are compacted with “
… (xx unchanged)
”, but all the other properties are still printed, even if they haven't changed.Would it be complex to implement some output style such as the output of some diff like:
becomes
or even
?
Beta Was this translation helpful? Give feedback.
All reactions