I've been exploring deps.edn as well and I might be confused about this. How do I call both my nrepl alias and the reveal alias (I've set up both using Sean Corfield's setup) such that I can do my normal editing (in vim in my case) connected to the nrepl while it is also sending that data to reveal. I suspect I don't have my head totally wrapped around reveal yet actually, so not sure if it's only an either/or thing. Definitely all seems cool though!
You can start a regular nREPL and then do
(add-tap ((requiring-resolve 'vlaaad.reveal/ui)))
which will start a Reveal UI. Then anything you (tap> ...)
will appear in Reveal.@sjharms Just a heads up, if you add "-i" to the main opts you get the repl prompt.
-i
means "init opts" so it would expect something after it (that you get a REPL is probably just a coincidence that it doesn't error check). -r
is the option to specifically start a REPL.
(or do you mean nREPL's command-line? in which case -i
probably means "interactive"... pity it uses the same option as clojure.main
but for a completely different meaning...)
I suspect you can automate by telling nREPL to execute that expression at startup (consult the nREPL docs).
Here's what I tested locally -- using just my deps.edn
setup:
(! 990)-> clj -M:reveal:nrepl
Downloading: vlaaad/reveal/maven-metadata.xml from clojars
Downloading: nrepl/nrepl/maven-metadata.xml from clojars
Downloading: vlaaad/reveal/1.1.178/reveal-1.1.178.pom from clojars
Downloading: nrepl/nrepl/0.8.3/nrepl-0.8.3.pom from clojars
Downloading: vlaaad/reveal/1.1.178/reveal-1.1.178.jar from clojars
Downloading: nrepl/nrepl/0.8.3/nrepl-0.8.3.jar from clojars
nREPL server started on port 58271 on host localhost - <nrepl://localhost:58271>
(that just sits that at that point). In another terminal:
(! 785)-> lein repl :connect 127.0.0.1:58271
OpenJDK 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
Connecting to nREPL at 127.0.0.1:58271
REPL-y 0.4.4, nREPL 0.8.3
Clojure 1.10.1
OpenJDK 64-Bit Server VM 15+36
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=> (add-tap ((requiring-resolve 'vlaaad.reveal/ui)))
nil
user=> (tap> [[1 2 3] [4 5 6]])
true
user=>
That data appeared in Reveal.Ok, I will try this. That's my other question about deps though which I should probably take over to that channel. When starting the nrepl I don't get a repl prompt like I do when doing the same with lein repl
My editor connects fine, but I don't get the prompt
yeah, you are getting the same behavior as me too then. I guess I can just stick with lein for now as I explore Reveal
there is a section in the docs that covers how to integrate with nrepl: https://vlaaad.github.io/reveal/#nrepl-based-editors
which I've used successfully
@chase-lambert Remember that I do not type into the REPL! That's why my :nrepl
alias only starts a server, that I can connect to from an editor (or attach a lein repl
as shown above).
I don't type into a repl either that's why I was wondering if I could keep my normal workflow while also having the data go to Reveal as well
Yeah, that link suggests this (again, using just my setup):
(! 993)-> clj -M:reveal:nrepl --middleware '[vlaaad.reveal.nrepl/middleware]'
that starts the server as before, but with the middleware -- so it will automatically start Reveal.Now if you connect to that server via an editor or other client, Reveal will echo everything sent to that nREPL server.
@jr0cket also wrote some helpful tips which he shared at https://practicalli.github.io/clojure/clojure-tools/data-browsers/reveal.html#using-reveal-with-nrepl-editors
Like so:
awesome, I'll play around with this. Thanks folks. (And I'm excited to see your upcoming talk on your RDD too Sean!)
@chase-lambert I have several aliases for Reveal in practicalli/clojure-deps-edn that may be of interest.
clj -M:repl/reveal-nrepl
starts the REPL process and runs the basic clojure terminal UI (nREPL interactive mode). Open a Clojure file in vim/neovim and connect via the nREPL server that has started.
clojure -M:inspect/reveal-nrepl
is the same as above but without a terminal UI.
There are light themed versions of these, along with other variations.
I've tested these with Neovim and Conjure, but not with fireplace specifically. If anyone has a vim setup they recommend, am happy to test it out or receive feedback on your setup and the practicalli aliases.
https://github.com/practicalli/clojure-deps-edn
Yep, I followed the advice to check this out earlier and got it all worked out. And your config showed me the "-i" option to give me that repl prompt I was looking for. Good stuff
Thanks. I didnt really understand the -i
option until I started experimenting with these aliases π
This sounds silly, but I use that alias and also didnβt realize the server / client distinction
Thank you for sharing
Interesting. The deps.edn
file says:
;; - start a modern nREPL server on a random available port:
:nrepl {:extra-deps {nrepl/nrepl {:mvn/version "RELEASE"}}
:main-opts ["-m" "nrepl.cmdline"]}
and the README says
:nrepl -- pulls in the latest stable release of nREPL and starts an nREPL server on a random available port
I'd be happy to make it clearer if you can suggest something @sjharms?(documentation can always be improved!)
I think that is clear, the challenge is in bootstrapping a new clojure workstation: Emacs -> Doom or Space or Prelude, clj command lines (try to search for examples, but then throws warning depending on the commit date), then start a project using clj new (thank you!), then try to do a cider-jack-in, but then realize something like reveal
is useful, so then take the combined aliases but unsure if something is stuck processing, or if there should be a blinking prompt
It works great if everyone has a baseline for βthis worksβ, just as beginners with lots of tabs and figuring it out, its easy to sort of skip by that detail
There's a (lot of) reason(s) I switched from Emacs/nREPL/CIDER to a simple/modern editor and a plain Socket REPL π
I wish people wouldn't recommend Emacs/nREPL/CIDER to beginners (well, unless they're already using Emacs) and I'm still very sad that "Brave and True" dives straight into Emacs. I mean, I used Emacs for decades... but I never really enjoyed it... and I don't like it when I go to learn a new language and everyone says "Oh, you need to use Editor X for this language!"...
Ha that sounds like the dream, excited for the video thank you again π
Working with large datastructures is non-ideal in the output panel (especially if you've tapped several in quick succession and trying to find to the right one). The structural navigation and screen-clearing helps (thanks!), but if you're tapping a lot of stuff asynchronously it's still hard to get a high-level view of what has happened. When working with these kind of structures, I find myself using atoms and vars a lot more just to help me tidy up my output panel. Are there any existing plans or ideas on somehow "folding" these large outputs or would this be considered a non-goal for the output panel?
I only ask, because reveal is quickly becoming an essential dev tool for me. :]
Hi! I was thinking about folding from time to time, I certainly find it very useful, but the ratio of implementation complexity vs leverage this feature provides unfortunately makes it low priority.
If you control these data structures, I would suggest putting a :vlaaad.reveal.stream/type ::my-big-data-structure
metadata on them and creating custom formatter that shows those as a short summary by default.
I described this approach here: https://clojureverse.org/t/reveal-1-0-read-eval-visualize-loop-for-clojure/6560/8?u=vlaaad
ah, I was thinking of doing something like this. Probably a good idea to merge this with some nav/datify sugar. Thanks for linking to the code!
for medium size data structures, I think treemaps might be a good fit, https://blog.phronemophobic.com/treemap/treemaps-are-awesome.html
Visualizing Clojure maps with treemaps is an interesting approach, but I think what I'm really missing sometimes is something like Fulcro Inspect's "DB Explorer" for an arbitrary map π
what's that DB explorer?
https://github.com/fulcrologic/fulcro-inspect#db-tab this one?
There's a newer version of the inspector than the one in those screenshots; the DB Explorer is a new tab next to that DB tab.
It's just a more streamlined and searchable iteration on the original https://github.com/fulcrologic/fulcro-inspect#db-tab
(and it does a better job of only showing relevant data on larger maps)
In case you missed it in the #announcements π
hmm, I wish I could see it in action, it's not clear what kind of inspector it is from this screenshot...
found it! https://youtu.be/ng-wxe0PBEg?t=1417
> Watching ref as latest value or log of successors? Why not both at the same time! π
Updated to it already. I love that if you have multiple tabs in a result panel, you can "preview" quickly via the new popup there -- that is incredibly useful!
@vlaaad you can think of DB Explorer as a navigable table view π
I too, as Fulcro Inspect user too, I miss a lot the folding on DB tab (more standard tree view, with folding on collections), and I also use DB Explorer a lot, I think they are complementary tools