I'm not sure I can do it, Rich told the way its implemented is internal details we shouldn't rely on in code (defn-ed functions have static fields pointing to vars)
Yeah, that doesn't actually surprise me -- although I'm pretty sure I've seen someone share the code on Slack at some point...
I think this is it: https://metaredux.com/posts/2019/05/04/discovering-runtime-function-references-in-clojure.html
Is there an example setup for Reveal with Cursive? I have been using REBL like this: https://github.com/cognitect-labs/REBL-distro/wiki/REBL-in-IntelliJ-Cursive
on that note I wish there was some more info on running it with cider... it occurred to me to run it directly on the cider REPL by invoking (vlaaad.reveal/repl)
and it broke all sort of havoc inside emacs, so I'm guessing there must be a different way to set it up
probably can run it from command line which is fine but then I won't be able to send things from emacs to the repl
Are you using nrepl? There is a middleware for nrepl
maybe... I usually use whatever cider does, which inserts middleware automatically
there's a mechanism to request custom middleware to be inserted that I always forget how to use 🙂
Then you are probably using nrepl 🙂 try finding a way to insert vlaaad.reveal.nrepl/middleware
in the middleware list
I think @onetom previously found a way to do it: he suggested creating .nrepl.edn
file with contents like these: {:bind "0.0.0.0" :port 5555 :middleware [vlaaad.reveal.nrepl/middleware]}
maybe that'll work for you?
@emmanueloga u should specify an alternative directory for your per-user nrepl.edn
file via the NREPL_CONFIG_DIR
env var.
here is an example .idea/runConfigurations/my-module.xml
:
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Rule Crib with Reveal over nREPL" type="ClojureREPL" factoryName="Local" activateToolWindowBeforeRun="false" singleton="true">
<module name="my-module" />
<setting name="replType" value="NREPL" />
<setting name="execution" value="DEPS" />
<setting name="jvmArgs" value="" />
<setting name="parameters" value="" />
<environment name="NREPL_CONFIG_DIR" value=".reveal" />
<setting name="workingDir" value="$PROJECT_DIR$/my-module" />
<setting name="profiles" value="" />
<setting name="aliases" value="reveal" />
<setting name="fixLineNumbers" value="false" />
<method v="2" />
</configuration>
</component>
and then, this is what i have in my .reveal/nrepl.edn
:
{:bind "0.0.0.0" :port 5555 :middleware [vlaaad.reveal.nrepl/middleware]}
cool thx
Rich shared the snippet used to get references. I then adopted it to create this runtime function call tracer: https://gist.github.com/vlaaad/0350b61e127e82165d195b490999ec0a
No example so far, but I'm planning to add it once reveal is going 1.0
In short, you create local repl run configuration with clojure.main, and select your parameters to be -m vlaaad.reveal repl
I’ll try this later today. Thanks!
Or, if you have such main-opts in a clj alias, you can select "run with deps" and select that alias