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
fabrao 2020-05-20T01:04:35.422Z

hello all, sorry my dumb question but is possible to start more than one repl session?

fabrao 2020-05-20T01:04:56.422300Z

with Chlorine?

fabrao 2020-05-20T01:05:31.422800Z

or connect to other repl session if already connected?

seancorfield 2020-05-20T01:20:03.423300Z

You can only be connected to one REPL at a time but it is easy enough to switch between REPLs. I do that all the time.

fabrao 2020-05-20T01:33:35.423700Z

you disconnect and connect to the other?

seancorfield 2020-05-20T01:45:20.424300Z

Yes. The REPL state remains the same so it's easy to just jump between REPLs as you need.

seancorfield 2020-05-20T01:45:47.424900Z

I often switch between a locally started REPL, a live app running locally, and a live app running on another server.

seancorfield 2020-05-20T02:13:51.425600Z

Just upgraded to 0.7.0 and started rewriting my init.coffee file in Clojure using the new extension facility -- very nice!

seancorfield 2020-05-20T02:22:32.426600Z

Although I don't think editor/get-selection works? I've tried a couple of functions based on it and when I execute them, nothing happens at all (well, Atom crashed one time).

seancorfield 2020-05-20T03:59:43.427300Z

Looks like get-selection is returning {:text nil :range nil} regardless of whether I have text selected or not.

seancorfield 2020-05-20T04:41:31.428200Z

I have all of my init.coffee file converted over to chlorine-config.cljs and everything works, modulo get-selection not working.

mauricio.szabo 2020-05-20T13:13:35.429100Z

Oh, I'll look at get-selection. Let me see if there's anything I missed

mauricio.szabo 2020-05-20T13:20:23.429600Z

Oh.... get-selection is using a completely wrong destructuring... will fix it.

mauricio.szabo 2020-05-20T14:00:34.429800Z

@seancorfield fixed on 0.7.1 ๐Ÿ™‚

2020-05-20T16:38:38.431400Z

Hello all, I have a similar question to fabrao above - when working on a fullstack app there will be at least 2 repls I'll want open at the same time - clj and cljs, and often more - another cljs for a node.js server for example. Is there a recommended approach to a setup like this with chlorine?

seancorfield 2020-05-20T16:40:14.431700Z

@mauricio.szabo That works perfectly now! Thank you!

seancorfield 2020-05-20T16:40:35.432200Z

(go click my Chlorine config link again to see the updated version)

seancorfield 2020-05-20T16:41:35.433100Z

I've removed all the init.coffee code now and I'm doing all of it via cljs -- is there a way to show Atom info/error messages? I switched those to plain println calls for now.

mauricio.szabo 2020-05-20T17:10:21.434500Z

@danvingo when I have to work with Clojure and ClojureScript, I use shadow-cljs together with lein or cli, and start the compilation process on the Clojure REPL

mauricio.szabo 2020-05-20T17:10:37.434900Z

That way, I can migrate between Clojure and ClojureScript with ease

mauricio.szabo 2020-05-20T17:12:01.436500Z

But... two different Clojure REPLs the thing starts to become complicated. I never had to use something like this, but I'm open to suggestions on how to implement it

mauricio.szabo 2020-05-20T17:15:01.438600Z

(or, to be more specific, how to present it - like, how do you select which files are evaluated by which REPL, which REPL is the "active" one, and so on... things are quite complicated today on how things are implemented, specially when you consider the semantics of ClojureScript REPLs)

2020-05-20T17:26:32.441500Z

the obvious UX idea that comes to mind is having UI tabs for each repl, the active tab is the active repl - the nice to have is a keyboard shortcut to switch between them.

2020-05-20T17:27:21.443700Z

(i'm just throwing out ideas, I have no idea how complicated, or not, this would be to implement ๐Ÿ™‚ )

seancorfield 2020-05-20T17:27:25.443900Z

Yeah. That's why I'm happy to explicitly switch between REPLS as needed. Especially since I'm switching between live processes.

mauricio.szabo 2020-05-20T17:27:39.444400Z

Well, you can have a situation when there's no REPL tab active at all ๐Ÿ˜„

2020-05-20T17:28:03.445400Z

maybe i just need some pointers on how to switch between repls

seancorfield 2020-05-20T17:28:11.445600Z

And I have my REPL tab mostly minimized

seancorfield 2020-05-20T17:30:58.448400Z

Having Chlorine remember recent REPLs and offer a drop down to switch would be less work than disconnecting and then connecting each time (and having to enter the port each time -- since all of my REPLs are over ssh tunnels or else local on different ports)

seancorfield 2020-05-20T17:32:15.450900Z

For me switching is ctrl-; e ctrl-; y (then type the port and press return)

mauricio.szabo 2020-05-20T17:33:00.451800Z

Yes, this approach can work fine - probably it'll be what I end up doing. Maybe add as a second command, so you don't accidentally disconnect your REPL ๐Ÿ˜„

2020-05-20T17:53:20.452200Z

yea the drop down of recent connections would work for me too

seancorfield 2020-05-20T18:05:44.453100Z

@mauricio.szabo Not sure if you noticed my additional question among all of that: with the new cljs extension stuff, is there a way to do Atom info/error popups?

mauricio.szabo 2020-05-20T18:12:05.453600Z

Oh, no, I didn't. Yes, there's a way, it's not yet documented, so let me see if I can reproduce here...

mauricio.szabo 2020-05-20T18:17:19.454800Z

Yes, @seancorfield, it's not yet documented (some APIs can change on the future) but there's already a way to call any callbacks that Chlorine registers when it connects to a REPL. For example, the code below will notify on Atom the current selected var:

(defn info []
  (let [{:keys [text]} (editor/get-var)]
    (editor/run-callback :notify {:type :info :title text})))

seancorfield 2020-05-20T18:18:23.455300Z

Oh nice!

mauricio.szabo 2020-05-20T18:18:55.455400Z

The current list of supported callbacks, and their schemas, are here: https://github.com/mauricioszabo/repl-tooling/blob/master/src/repl_tooling/editor_integration/schemas.cljs#L70-L90

seancorfield 2020-05-20T18:30:15.456400Z

Oh this is so much nicer than writing CoffeeScript or JS to extend the editor! Thank you @mauricio.szabo -- this is truly awesome work!

mauricio.szabo 2020-05-20T19:55:42.460500Z

Glad that you like it ๐Ÿ˜„. I'm also using it on some experiments, and as soon as I remove those strange internal state like Browsable and friends, I believe it'll be easier to hack more complex things!

fabrao 2020-05-20T20:20:48.463500Z

Hello all, when Iยดm in deps.edn and I save the file, in Chlorine console shows

java.lang.IllegalArgumentException: "No value supplied for key: true"
in clojure.lang.PersistentHashMap.create (PersistentHashMap.java:77)
in clojure.core/hash-map (core.clj:387)
in clojure.core/hash-map (core.clj:379)
in clojure.lang.RestFn.applyTo (RestFn.java:137)
in clojure.core/apply (core.clj:665)
in clojure.core/load-lib (core.clj:5934)
in clojure.core/load-lib (core.clj:5928)
in clojure.lang.RestFn.applyTo (RestFn.java:142)
in clojure.core/apply (core.clj:667)
in clojure.core/load-libs (core.clj:5985)
why? The "Should we refresh namespaces when save a file (Clojure Only)?" is on

fabrao 2020-05-20T20:21:34.464300Z

is Chlorine trying to evaluate deps.edn file?

mauricio.szabo 2020-05-20T20:24:24.465300Z

With simple refresh, and evaluate on save, probably... I don't remember making a code to disable it for .edn files, will open an issue ๐Ÿ™‚

seancorfield 2020-05-20T21:04:48.466Z

Seriously, just turn refresh off and get used to a tighter REPL-driven workflow instead. Auto-reload/-refresh is a can of worms.

1
jaihindhreddy 2020-05-20T21:36:17.470800Z

I've been a fan of the reloaded workflow ever since Stuart Sierra's talk, but have increasingly been simplifying the tools I use, as per advice from you and Stuart Halloway. Badly written component impls may create dangling resources on reload, and reloads might get slow in large enough systems. I'm sure there are many more worms from that can. Can you please point out a couple more?

seancorfield 2020-05-20T22:17:59.471100Z

The main thing I've seen is refresh-based workflows which sometimes seem unable to load code after removing definitions that it depends on. When beginners report these problems, it's almost impossible to tell what they've done "wrong" and a restart of their REPL nearly always fixes it.

seancorfield 2020-05-20T22:19:58.471300Z

When I have tried various reload/refresh workflows in the past, they nearly always break in hard-to-debug ways -- and tooling should make life easier not create additional problems.

๐Ÿ’ฏ 1
seancorfield 2020-05-20T22:21:01.471500Z

Since I've moved to a simpler REPL workflow, where I control all of the evaluation/removal/etc, I hardly ever get into a bad state even with a REPL running for weeks at a time.

๐Ÿ˜ฒ 1
seancorfield 2020-05-20T22:24:55.471700Z

Although funnily enough I did break my REPL state last week -- for the first time in many months. I think I got sloppy about eval'ing changes and then I removed a namespace to force some global state there to be recreated (`defonce`, protocol, record, something like that), and then a (require ... :reload-all) broke and it was just easier to restart the REPL than spend time figuring out the incantation needed to get things back to a sane state...

๐Ÿ˜„ 1
seancorfield 2020-05-20T22:25:24.471900Z

...if it happens again any time soon, I'll probably spend a bit more time figuring out a simple automation for the solution ๐Ÿ™‚