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
sparkofreason 2020-02-24T13:47:59.003800Z

Made some progress on using Reveal (would have been more straightforward except I was typing vlaad instead of vlaaad, amongst other things 🤪). Now it does start, but when I try to connect Chlorine it gives a bunch of errors like

Clojure 1.10.1
Syntax error reading source at (REPL:1:3).
Conditional read not allowed

(:cljs :using-cljs-repl :clj :using-clj-repl :cljr :using-cljr-repl :joker :using-joker-repl :clje :using-clje-repl :bb :using-bb-repl)
Execution error (IllegalArgumentException) at user/eval3943 (REPL:1).
Wrong number of args passed to keyword: :cljs

:using-unknown-repl
=> :using-unknown-repl
Syntax error reading source at (REPL:3:74).
Conditional read not allowed
The alias I'm using looks like
:reveal {:extra-deps {vlaaad/reveal {:mvn/version "0.1.0-ea4"}}
           :jvm-opts ["-Dclojure.server.repl={:port,50505,:accept,vlaaad.reveal.prepl/-main}"]}
I'm guessing this is something to do with Chlorine initializing the connection? Maybe https://clojure.atlassian.net/projects/CLJ/issues/CLJ-2453? Running from the command line directly seems to work fine.

seancorfield 2020-02-24T16:36:32.005100Z

@dave.dixon Chlorine expects a standard socket repl -- you're starting a prepl I think?

sparkofreason 2020-02-24T16:37:49.007600Z

Reveal is. @vlaaad is looking into starting a standard repl. See https://github.com/vlaaad/reveal/issues/2

mauricio.szabo 2020-02-24T16:38:26.008700Z

Yes, that's probably the problem. When Chlorine connects, the first thing it does is send a form to detect which clojure "flavor" is running

seancorfield 2020-02-24T16:39:19.010400Z

Right. I was going to suggest starting Reveal's regular main and also starting a standard socket REPL -- that's how we work with REBL.

sparkofreason 2020-02-24T16:39:46.010800Z

Ahhh.

seancorfield 2020-02-24T16:40:34.012200Z

Reveal needs an API to "submit" form/value data so that you can programmatically add things to its browser.

seancorfield 2020-02-24T16:41:15.013300Z

Given that it has nrepl Middleware that should be in place already -- you can probably see what function needs to be called.

vlaaad 2020-02-24T16:44:31.013600Z

I've been summoned :)

vlaaad 2020-02-24T16:49:36.013800Z

There is no regular main in Reveal, but I'm going to add normal REPL without prepl backend. FYI, there is no static REBL-like submit function, but calling vlaaad.reveal.ui/make will return a function that can be used to submit values. Then making it static is just a matter of def-ing it where you want

vlaaad 2020-02-24T16:53:37.014Z

Created #reveal channel for Reveal-specific discussions

mauricio.szabo 2020-02-24T17:43:49.017400Z

Hey @vlaaad! I was just about to send you a message! Good to see you here. I think your project and Chlorine have lots of common ground. The only thing is that reveal is just Clojure, right? Any plans to implement a cljs version?

mauricio.szabo 2020-02-24T17:44:58.018600Z

For example, lots of people ask me for a way to navigate the rendered result with the keyboard, or to search parts of the result with a string...

vlaaad 2020-02-24T17:57:10.020500Z

I think one of the biggest strengths of tools like Reveal is being in-process: it can effortlessly keep references to objects, which allows lots of meaningful inspections. Cross-process is bound to be limited by serialization, that's why I don't have plans to explore clojurescript support. With that said, since Reveal can prepls, and can receive prepls as parameters, it can already connect to cljs environments

vlaaad 2020-02-24T17:57:21.020600Z

It's just not documented :)

avi 2020-02-24T22:24:44.022Z

I apologize if this is a FAQ… is there a known issue related to loading a file using Chlorine, then switching to the REPL in the terminal and attempting to call a fn in a var in the loaded namespace and getting this:

user=> (my-ns/my-fn)
Execution error (IllegalStateException) at unrepl.core/non-eliding-write (REPL:31).
Attempting to call unbound fn: #'unrepl.core/write
?

avi 2020-02-24T22:26:02.022600Z

(Atom 1.44.0, Chlorine 0.4.10, MacOS 10.15.1, Clojure 1.10.1.510, JRE 13.0.2)

mauricio.szabo 2020-02-24T22:26:04.022700Z

Wow, I never saw this issue. What are the steps to reproduce?

mauricio.szabo 2020-02-24T22:26:59.023700Z

(I think I saw Sean having this problem, but evaluating inside Chlorine. It'll be wonderful if I can reproduce it 🙂)

avi 2020-02-24T22:27:11.024Z

Well first I launch my repl from the shell/terminal

avi 2020-02-24T22:27:21.024300Z

then launch atom, connect chlorine

avi 2020-02-24T22:27:25.024500Z

then load the open file

avi 2020-02-24T22:27:39.024900Z

then switch to terminal and attempt to call one of the functions in the file

seancorfield 2020-02-24T22:28:28.026Z

Ah, I'm "glad" someone else has run into that problem! I was never able to track down how to repro, and it hasn't happened since I last mentioned it in this channel!

😅 1
avi 2020-02-24T22:28:29.026100Z

happy to screen-share or whatever to help debug

avi 2020-02-24T22:28:38.026300Z

screen recording?

mauricio.szabo 2020-02-24T22:30:18.027900Z

There's no open issue, I'll be glad if you open it with the screen recording! I'll update to Java 13 and see if I can reproduce here (please, when you open the issue, run java -version so I can see the exact Java version)

seancorfield 2020-02-24T22:30:38.028200Z

I ran into it on Adopt OpenJDK 11.

seancorfield 2020-02-24T22:30:45.028400Z

(11.0.5)

avi 2020-02-24T22:30:53.028600Z

will do

avi 2020-02-24T22:31:04.028800Z

openjdk version "13.0.2" 2020-01-14
OpenJDK Runtime Environment AdoptOpenJDK (build 13.0.2+8)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 13.0.2+8, mixed mode, sharing)

mauricio.szabo 2020-02-24T22:41:51.030900Z

Somehow I can't reproduce on Linux (just installed OpenJDK 13.0.2). I'm hoping is not something specific of some O.S. (I saw some issues on MacOSX before, but they were unrelated to JDK / Clojure REPL)

avi 2020-02-24T22:44:09.031300Z

Most likely PEBKAC and I’m wasting your time 😬

avi 2020-02-24T22:44:38.032200Z

I can’t add a screen recording right now but happy to do so tomorrow if that’d help

seancorfield 2020-02-24T22:45:43.032900Z

@mauricio.szabo How does the "break evaluation" piece work in Chlorine?

mauricio.szabo 2020-02-24T22:46:56.035300Z

When I start an evaluation, UNREPL sends me a code that can be used to stop the evaluation. So, I use another connection to the socket REPL and send this command to stop the evaluation

seancorfield 2020-02-24T22:47:01.035500Z

Over in the #clojure-dev channel, we are talking about prepl not supporting interruptible evals, and @ghadi mentioned that nREPL's way of handling it -- calling Thread/stop -- is "broken" so I wondered about Chlorine/unrepl.

mauricio.szabo 2020-02-24T22:47:21.035900Z

UNREPL runs all code on (future ....)

mauricio.szabo 2020-02-24T22:47:35.036800Z

So it just cancels the future

seancorfield 2020-02-24T22:47:44.037Z

OK. Cool.

mauricio.szabo 2020-02-24T22:48:58.037500Z

@aviflax can you send me the full contents of the editor when you tried to load-file?

avi 2020-02-24T22:49:31.038100Z

I can point you to the repo, let me just make sure I can reproduce on master (as opposed to the branch I’m working on that’s currently local only)

avi 2020-02-24T22:49:45.038400Z

(I just added my deps.edn aliases to the issue)

avi 2020-02-24T22:51:10.038700Z

oh weird, it seems to work fine on master

avi 2020-02-24T22:51:34.039300Z

so the cause must be discernible in the branch diff

avi 2020-02-24T22:52:36.039500Z

confirmed

avi 2020-02-24T22:53:06.039900Z

I might just push the branch and point you to the diff

avi 2020-02-24T22:59:17.040400Z

(I’ve added that to the issue as well)

mauricio.szabo 2020-02-24T23:24:05.041200Z

@aviflax thanks a lot! I can reproduce this issue just fine! I'll see if there's a fix, or if it's some error with UNREPL 🙂

avi 2020-02-24T23:24:17.041400Z

great!

avi 2020-02-24T23:42:42.042600Z

@mauricio.szabo I’ve got another commit on that branch, locally… in which I fixed the new code, which means the tests are no longer failing. I thought I’d see if the unrepl problem still occurs, and it does not

avi 2020-02-24T23:42:57.043Z

I can push that commit if that’d be helpful to you, or hold off, whatever’s more helpful

mauricio.szabo 2020-02-24T23:46:20.043300Z

Yes, I just found the issue too...

mauricio.szabo 2020-02-24T23:49:25.045400Z

For some reason, the output stream of clojure.test does not redirect to the socket. Just after connecting, Chlorine does the redirection right here: https://github.com/mauricioszabo/repl-tooling/blob/master/src/repl_tooling/repl_client/clojure.cljs#L155-L157

avi 2020-02-24T23:51:35.046600Z

Aha!

avi 2020-02-24T23:51:39.046900Z

well that’s good!

avi 2020-02-24T23:51:41.047100Z

…right?

mauricio.szabo 2020-02-24T23:52:11.047800Z

Yes, that's good. When I re-issue this command, it works So, probably what I'll do is re-bound this variable from time to time... maybe? 😄

avi 2020-02-24T23:52:18.048Z

😬

avi 2020-02-24T23:53:06.048200Z

avi 2020-02-24T23:53:42.049100Z

gotta run. Thanks for the help — and all your work on the tool! :thanks3:

mauricio.szabo 2020-02-24T23:55:24.049400Z

Thank you too, for reproducing this error! 🙂