JoshCheek / seeing_is_believing

Displays the results of every line of code in your file
1.3k stars 54 forks source link

When adjacent lines are executed the same # of times, align the output values #76

Closed JoshCheek closed 7 years ago

JoshCheek commented 7 years ago

Eg, consider this program

node3 = ['c']
node2 = ['b', node3]
node1 = ['a', node2]

node = node1
while node
  node[0] # => "a", "b", "c"
  node[1] # => ["b", ["c"]], ["c"], nil
  node = node[1]
end

It would be nice for the outputs to line up, like so:

node = node1
while node
  node[0] # => "a",          "b",   "c"
  node[1] # => ["b", ["c"]], ["c"], nil
  node = node[1]
end
JoshCheek commented 7 years ago

+1

JoshCheek commented 7 years ago

I've added this as a feature and turned it on by default (I try to make the defaults what I think most people would want it to do rather than avoiding change -- if avoidance of change is desired, there are flags to explicitly set a default).

It works on both normal SiB and xmpfilter style. @avdi and @jcinnamond if you wouldn't mind installing it locally and letting me know if it's better or worse / if there are changes I should make, I'd appreciate it (clone, gem build seeing_is_believing.gemspec, gem install seeing_is_believing-3.0.1.gem).

I just kept winding up wanting to show how results on one line matched up with results on the next, but their inspected value didn't line up, so I wound up editing the comments by hand on many occasions.

If it annoys you, you can turn it off with the --no-interline-align option.

The feature is here for SiB style and here for xmpfilter style.


Other recent changes:

JoshCheek commented 7 years ago

I haven't released it yet, so there is time to change defaults.