chlorine-clover

About Chlorine for Atom and Clover for VS Code: https://atom.io/packages/chlorine and https://marketplace.visualstudio.com/items?itemName=mauricioszabo.clover
seancorfield 2020-08-24T04:30:17.004Z

I realized tonight that it would be really easy to create a Socket REPL adapter that automatically submits forms/values to Cognitect's REBL, without needing the customization I've previously been adding to Chlorine: https://github.com/seancorfield/socket-rebl -- this would also be usable by Clover to integrate with REBL, without needing custom code.

seancorfield 2020-08-24T05:04:07.004900Z

Ah, I've just realized why this won't actually work! Chlorine starts up a separate Socket REPL over which it sends the actual evaluations 😞

seancorfield 2020-08-24T05:19:29.006Z

I suspect Clover does the same? Oh well, it's still a nice, useful utility for folks who want to telnet into a REBL instance with a Socket REPL I suppose 😞

mauricio.szabo 2020-08-24T12:55:23.006800Z

Almost - Chlorine sends a piece of code that will make the REPL more programmable. Without it, it would be really difficult to add tooling over the REPL.

mauricio.szabo 2020-08-24T12:56:06.007700Z

But... maybe we can somehow work on this direction? Maybe make this "socket REBL" return the form that Chlorine expects? I'll investigate alternatives 😄

mauricio.szabo 2020-08-24T12:56:57.008800Z

(after all, there's currently support for at least 4 different REPLS: the "regular socket REPL", "Clojure with UNREPL", "nREPL", and "Shadow-CLJS Relay REPL")

seancorfield 2020-08-24T17:13:36.009900Z

@mauricio.szabo The only difference between the bare bones Socket REPL and my library above, is the :eval function is wrapped to call cognitect.rebl/submit on the form and value: https://github.com/seancorfield/socket-rebl/blob/master/src/socket/rebl.clj#L13-L21

seancorfield 2020-08-24T17:15:25.011800Z

What's interesting is that this causes REBL to show the negotiation that Chlorine does, since it adds all those initial forms to REBL as they are evaluated. But once Chlorine has negotiated that this is a regular Socket REPL on the JVM, I gather that starts a second socket REPL for the unrepl stuff to communicate over?

seancorfield 2020-08-24T17:19:06.012300Z

Here's what I see in REBL, sent by Chlorine, before it switches over to a separate socket REPL:

seancorfield 2020-08-24T17:19:42.013Z

(it's in reverse time order: most recent command at the top)

mauricio.szabo 2020-08-24T18:07:44.013800Z

Yes, there are two REPLs connected: one for autocomplete, load-file, goto-var-definition, etc, and another for evaluations so using one doesn't interfere on other 🙂

seancorfield 2020-08-24T18:12:34.014500Z

It sure would be nice if they were swapped around so evaluations happened on the primary REPL and all the other stuff happened on the secondary.

seancorfield 2020-08-24T18:12:49.014800Z

(since the primary REPL is the one users have control over)

seancorfield 2020-08-24T18:13:43.015600Z

I didn't dig too deep into non-eval ops to see if anything else uses the primary REPL. Will do that when I get off my daily standup.

mauricio.szabo 2020-08-24T18:14:51.016500Z

(I believe that's the way it is - the first REPL to be connected is the "primary" 😄)

seancorfield 2020-08-24T18:34:56.017Z

OK, I tested, and it doesn't look like anything goes over the primary socket REPL after the negotiation code.

seancorfield 2020-08-24T18:37:12.019Z

I verified that connecting to that Socket REPL from other sources (e.g., telnet) does indeed go through that submit-eval above, so socket.rebl/repl is used as the :accept for new connections, but none of Chlorine's built-in operations go through it, so all of the operations must be happening on secondary socket REPLs that are opened after negotiation @mauricio.szabo FYI

mauricio.szabo 2020-08-24T18:39:13.020500Z

No, I believe I know what happens... As Chlorine is using UNREPL, it is probably starting a new REPL inside the Socket REPL - by running clojure.main/repl or something, so when it issues this command, it never returns then newer commands never go through...

mauricio.szabo 2020-08-24T18:39:33.020800Z

Ah, yes, that's exactly what happens: https://github.com/mauricioszabo/unrepl/blob/master/src/unrepl/repl.clj#L410

seancorfield 2020-08-24T18:57:58.022500Z

Ah, yes, that would do it too 🙂

seancorfield 2020-08-24T18:59:37.023400Z

So unrepl would essentially need an :eval middleware wrapper in order to make my socket.rebl stuff work. Oh well...

mauricio.szabo 2020-08-24T23:54:18.024400Z

Some experiments: by using some new features of interactive-renderer, I'm trying to change the way test errors are being rendered on the editor:

3