conjure icon indicating copy to clipboard operation
conjure copied to clipboard

Add tap support

Open Olical opened this issue 3 years ago • 1 comments

Like the title, I would like tap support like I had in the days of prepl. I remember it being tricky to implement with nREPL and I can't remember what stopped me from doing it before. I'll have another look!

Olical avatar Jun 24 '21 08:06 Olical

Worked out how I'm going to do this! After reading through https://github.com/clojure-emacs/cider/issues/3055 I think I'll end up with something similar. I'm going to set up a tap once upon connection which will do the same as that issue, store each tapped value into a queue.

Then I'll pop off the stack and display them inside the Conjure log buffer in different ways, I think by default after each eval I'll send off a "get me stuff from the queue" command after it happens... possibly periodically? Or maybe I'll add a mapping that prints the current top of the stack (or all values) when invoked, not sure yet.

But that's the crux of it, I'll have to collect tapped values and pull them out later. It'd be nice to find a way to have taps just flow out automatically but I'm not sure if that's possible and may lead to issues if it's printing too much and people can't turn it off.

So maybe a user initiated pull of tapped values might be good... OH. Especially if:

  • The way you get the tapped values out is through an easy mapping
  • That mapping actually performs a transparent eval, like a user initiated one, that you can see in the log
  • You can take that eval, modify it and transform what's currently in the "tap ring"
  • So you can map/filter/reduce what's stored from the tap, or just print it all
  • Users can store references in vars to keep a snapshot of tapped values at a point in time

So, yes, I think use initiated lookup and have it work very transparently so people can see the var the values are stored in, or atleast the function that returns them.

Olical avatar May 02 '22 16:05 Olical