reveal

Docs: https://vlaaad.github.io/reveal/ Source: https://github.com/vlaaad/reveal
vlaaad 2021-01-17T11:05:24.011100Z

@seancorfield I recently wrote a post in my blog about setting up Reveal and networked REPLs, I would suggest starting there: https://vlaaad.github.io/reveal-repls-and-networking Here is an example setup (using powershell/clj on windows escaping) from that post: 1. remote process

clj -Sdeps '{:deps {org.clojure/clojurescript {:mvn/version ""1.10.764""}}}' -X clojure.core.server/start-server :name '"cljs"' :accept cljs.server.browser/prepl :port 7777 :server-daemon false
this runs cljs prepl, so it's impossible to have reveal there since it's a JVM program 2. reveal
clj -Sdeps '{:deps {vlaaad/reveal {:mvn/version ""1.2.188""}}}' -X clojure.core.server/start-server :name '"reveal"' :accept vlaaad.reveal/remote-prepl :args '[:port 7777]' :port 6666 :server-daemon false
this runs reveal that talks to remote process. 3. client (`nc` will do, but I'm going to use clojure repl client)
clj -Sdeps '{:deps {vlaaad/remote-repl {:mvn/version ""1.1""}}}' -X vlaaad.remote-repl/repl :port 6666
in the client process, I can then evaluate a form like js/console , and it will output this in reveal:
js/console
=> #js {:group #object [group]
        :table #object [table]
        :dir #object [dir]
        :warn #object [warn]
        :trace #object [trace]
        :time #object [time]
        :profileEnd #object [profileEnd]
        :timeStamp #object [timeStamp]
        :debug #object [debug]
        :assert #object [assert]
        :groupCollapsed #object [groupCollapsed]
        :countReset #object [countReset]
        :count #object [count]
        :info #object [info]
        :timeEnd #object [timeEnd]
        :timeLog #object [timeLog]
        :error #object [error]
        :exception #object [exception]
        :dirxml #object [dirxml]
        :groupEnd #object [groupEnd]
        :log #object [log]
        :profile #object [profile]
        :clear #object [clear]}
Now, in this client process I can then evaluate {:vlaaad.reveal/command '(open-view v) :env {'v *1}} , and cljs will return to reveal a map that will be interpreted as a command to open last evaluation (a map describing js/console) result in a result panel instead of submitting it to output panel

vlaaad 2021-01-17T11:06:04.011600Z

that's how it will look:

vlaaad 2021-01-17T11:14:18.015500Z

Now, this is done with built-in remote prepl. If you manage Reveal window yourself, i.e. using (vlaaad.reveal/ui) , basically what you need to support reveal commands is to ensure that values containing :vlaaad.reveal/command keys are submitted to UI fn as is. In built-in repls, this is done like that: https://github.com/vlaaad/reveal/blob/master/src/vlaaad/reveal/repl.clj#L26-L31 In your dev code, it looks like you are all set since you also use a built-in reveal repl: https://github.com/seancorfield/dot-clojure/blob/develop/dev.clj#L159

seancorfield 2021-01-17T17:32:37.020Z

@vlaaad Thanks! That makes sense now. I'd read the blog post before (several times) but still couldn't apply it to the setup I was talking about -- because I was thinking about it connected the other way around... I'll try this on Monday.

seancorfield 2021-01-17T18:11:02.021300Z

Ah, I think my problem with this setup is that I need Socket REPL for VS Code/Clover to connect to, not a prepl. So it won't connect to Reveal when Reveal is using a remote-prepl.

vlaaad 2021-01-17T19:22:36.021400Z

But you are using clover to connect to a local jvm, right? And then you use tap to submit values to Reveal? Tap can be used for submitting commands too

vlaaad 2021-01-17T19:23:37.021500Z

I'm not sure how to configure clover to go through Reveal to some remote process in a way that allows Reveal to see values instead of unrepl internals

seancorfield 2021-01-17T19:26:20.023400Z

If Reveal exposed a Socket REPL and relayed interactions via its remote-prepl to a (socket) prepl started in my legacy process, then I could connect Clover to Reveal via that Socket REPL.

seancorfield 2021-01-17T19:28:21.024600Z

(if Clover could work with a prepl that would also solve the problem -- but Mauricio says that there's quite a bit of the editor-friendly aspects of Socket REPL usage that are very hard with a prepl)

seancorfield 2021-01-17T19:32:14.026Z

And I can't run Reveal directly in the legacy process (for various reasons -- partly because it has to run on JDK8)

vlaaad 2021-01-17T19:50:35.026400Z

hmm, maybe this is already supported with out-fn

vlaaad 2021-01-17T19:51:04.026900Z

for example, given previous setup with clojurescript prepl on port 7777:

clj -Sdeps '{:deps {vlaaad/reveal {:mvn/version ""1.2.188""}}}'
Clojure 1.10.1
user=> ((requiring-resolve 'vlaaad.reveal/remote-prepl) :port 7777 :out-fn #(-> % :val println))
js/window
#object [Window [object Window]]

vlaaad 2021-01-17T19:54:40.029300Z

would be nice if clover used 2 connections to a process, where first has to be configured in a way clover wants, and it's used for clover machinery (e.g. autocompletion), and second is configured in a way user wants, and it's used for user-submitted forms (e.g. send form to repl, switch ns to current file etc)

seancorfield 2021-01-17T20:04:55.030900Z

Maybe when I'm back at work, I'll look at making a Socket REPL server that relays to a remote prepl -- that's the missing part.