zachallaun/mneme

Switching between generated auto assertions is not very clear

axelson opened this issue · 2 comments

I think the output of an auto_assert that uses maps is a little hard to grok initially:
Screenshot 2023-11-04 10-19-46

I initially assumed that j and k moved between different auto assertion errors, not between different possible assertions. I think a line of text giving instructions like "Press j or k to see other possible assertions" would be very helpful for new users.

Also the text color for j and k does not show up very well on many shells (I have a similar issue with the filename for tests)

Really valuable feedback, thanks!

A few changes that could be made to improve this:

  1. The obvious one, stop using whatever color I'm using for the j/k since it doesn't have good theme compatibility.
  2. While I've put all the "key bindings" next to each other at the bottom, perhaps it would be valuable to duplicate at least the j/k along with some additional text above the current suggestion. Something like, "1 of 2 (use j/k to scroll)".
  3. Regarding maps, Mneme currently uses a heuristic to select the initial pattern which defaults to the "simplest" pattern that matches. I find this helpful for certain nested structures, but may not be desirable for "top-level" maps -- you usually want to assert at least one level deep. I can think of three options here:
    1. Change the default heuristic to select the first pattern with top-level maps expanded. This is probably closer to what you'd want in the average case.
    2. Change the default heuristic to select the most-expanded (i.e. most complex) pattern instead of the simplest. I think I'd prefer the previous option, though.
    3. There is support for "pattern notes", where certain pattern types display additional explanation below. "Collapsed" maps could include such a note. I think this might be a bit much though, since after you know what's going on, this note is going to take up space unnecessarily forevermore.

I think that 1. and 2. above are pretty clear wins. 3i. also seems like it would be an improvement. There are two driving factors for the default selected pattern: select the pattern that is most likely to be the one you want, and secondarily, be consistent in what is selected so that users can develop intuition for what Mneme will generate/select. I think I've let that second goal override the first with the current behavior.

While I've put all the "key bindings" next to each other at the bottom, perhaps it would be valuable to duplicate at least the j/k along with some additional text above the current suggestion. Something like, "1 of 2 (use j/k to scroll)".

I think that would be great! Although I think that new users may find "scroll" a bit ambiguous. Maybe "use j/k to change patterns" would be more clear?