Fork me on GitHub
#reveal
<
2020-12-18
>
Chase00:12:05

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!

seancorfield00:12:18

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.

Chase00:12:32

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

seancorfield00:12:17

That's expected: my :nrepl alias starts an nREPL server, not an nREPL client.

sjharms04:12:07

This sounds silly, but I use that alias and also didn’t realize the server / client distinction

sjharms04:12:12

Thank you for sharing

seancorfield04:12:29

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 @U5JQAQE4X?

seancorfield04:12:48

(documentation can always be improved!)

sjharms04:12:19

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

sjharms04:12:14

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

3
seancorfield05:12:40

There's a (lot of) reason(s) I switched from Emacs/nREPL/CIDER to a simple/modern editor and a plain Socket REPL 🙂

seancorfield05:12:32

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!"...

👍 6
sjharms05:12:07

Ha that sounds like the dream, excited for the video thank you again 🙂

Chase15:12:08

@U5JQAQE4X Just a heads up, if you add "-i" to the main opts you get the repl prompt.

seancorfield18:12:16

-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.

seancorfield18:12:08

(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...)

seancorfield00:12:00

I suspect you can automate by telling nREPL to execute that expression at startup (consult the nREPL docs).

seancorfield00:12:20

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 - 
(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.

Chase00:12:17

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

phronmophobic00:12:28

there is a section in the docs that covers how to integrate with nrepl: https://vlaaad.github.io/reveal/#nrepl-based-editors

phronmophobic00:12:53

which I've used successfully

seancorfield00:12:24

@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).

Chase00:12:37

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

seancorfield00:12:04

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.

seancorfield00:12:36

Now if you connect to that server via an editor or other client, Reveal will echo everything sent to that nREPL server.

Chase00:12:24

awesome, I'll play around with this. Thanks folks. (And I'm excited to see your upcoming talk on your RDD too Sean!)

😊 3
practicalli-johnny01:12:52

@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

Chase15:12:14

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

practicalli-johnny15:12:44

Thanks. I didnt really understand the -i option until I started experimenting with these aliases 🙂

pithyless09:12:31

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?

vlaaad09:12:43

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

👍 6
pithyless09:12:14

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!

phronmophobic17:12:06

for medium size data structures, I think treemaps might be a good fit, https://blog.phronemophobic.com/treemap/treemaps-are-awesome.html

👀 9
pithyless19:12:54

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 🙂

👍 3
vlaaad20:12:29

what's that DB explorer?

pithyless20:12:51

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.

pithyless21:12:09

It's just a more streamlined and searchable iteration on the original https://github.com/fulcrologic/fulcro-inspect#db-tab

pithyless21:12:02

(and it does a better job of only showing relevant data on larger maps)

vlaaad22:12:26

hmm, I wish I could see it in action, it's not clear what kind of inspector it is from this screenshot...

wilkerlucio22:12:50

@U47G49KHQ you can think of DB Explorer as a navigable table view 😉

wilkerlucio22:12:23

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

pithyless09:12:41

I only ask, because reveal is quickly becoming an essential dev tool for me. :]

❤️ 6
vlaaad22:12:56

In case you missed it in the #announcements 🙂

pithyless22:12:46

> Watching ref as latest value or log of successors? Why not both at the same time! 😍

seancorfield22:12:08

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!