Hey there! I just released 1.2.188
, which is getting close to be a 1.3.*
release, give it a try! It introduces a feature called commands: values that, when submitted to Reveal window, will change the UI. All commands exist as functions in vlaaad.reveal.ext
ns:
- (defn submit [value] ...)
submits supplied value to the output panel. This is provides a way to override result prefix (like =>
or tap>
) in default REPLs/nrepl middleware, e.g. evaluating (tap> (rx/submit 1))
will add 1
instead of tap> 1
;
- (defn clear-output [] ...)
will clear the output panel;
- (defn open-view [value & {:keys [form new-result-panel]}] ...)
will show supplied value in a result panel;
- (defn all [& commands])
will execute a sequence of commands;
- (defn dispose [])
will close and dispose the window.
In addition to that, you can submit a command map with a form to eval in the process where Reveal window runs. Example of such command map:
{;; a code form to execute
:vlaaad.reveal/command '(open-view {:fx/type ref-watch-latest-view
:ref value})
;; optional env map from symbols to any objects
:env {'value (atom 1)}
;; optional ns to execute in (default is 'vlaaad.reveal.ext)
:ns 'vlaaad.reveal.ext}
This command map is useful in 2 scenarios:
• when Reveal is talking to remote processes that don't have Reveal on the classpath (e.g. clojurescript process). Since evaluation of this map does not require any dependency on Reveal, it can go through remote process and back without any trouble. The :env
in this case can be used to pass some value from remote process to Reveal without having to deal with embedding it into code form. For example, showing latest result (`*1`) in a new result panel can be done with this map: {:vlaaad.reveal/command '(open-view value) :env {'value *1}}
;
• when committing code that might or might not have Reveal on the classpath when executed, e.g. in dev tooling setup code or even in production code that taps some system state on the startup for dev tools to pick up.
Please give it a try and tell me what you think 🙂So I could have a legacy server process that doesn't include Reveal, and I could have it connect to and send commands to a standalone separate Reveal process for debugging?
I'm trying to get my head around how to connect the pieces together. If I start a plain Socket REPL around the legacy process, I can connect to it from nc
or telnet
or VS Code/Clover and I can send it stuff to evaluate. But what code would I need to send it, to get it to connect to the Reveal process?