-
Notifications
You must be signed in to change notification settings - Fork 47
Description
Not sure if this is better suited for cider, cider-nrepl or here.
A "Runtime" in CLJS is a JS engine that has loaded the compiled CLJS code and somehow connected to a REPL server like figwheel or shadow-cljs. There are several situations where it is likely that a given CLJS build has multiple connected runtimes. Say you are building a Browser-targeted SPA and have it open simultaneously in Firefox and Chrome. A react-native app running in multiple devices/emulators and so on. Each of these runtimes can potentially be used to eval code for a REPL. For CLJ there is only one given Runtime (the JVM) so it doesn't have this issue.
@bhauman recently did some work on figwheel that added the ability to "focus" a given "session" referring to what I call "Runtime" I think) but given that this in figwheel.repl it is not a generic API and therefore would put additional burden on Tool authors to support various different implementations.
I wonder if it would make sense if we added a couple different nREPL ops so that clients can query which runtimes/sessions are available and present a "smarter" UI to pick which to eval in.
It would also be possible to send a nREPL message notifying the nREPL client (eg. cider) that a Runtime disconnected or connected, eg. when the user closed the browser or reloaded the page. All client-side REPL state will be lost and the cider may want to do something?
cider already asks which build to connect to by reading the config for shadow-cljs but it would be more accurate to pick the runtime to connect to.
Any thoughts?