reveal

Docs: https://vlaaad.github.io/reveal/ Source: https://github.com/vlaaad/reveal
2020-12-13T13:32:55.363100Z

Hello, I am testing reveal for fun, and I wonder if you were interested with some feedback or questions?

2020-12-13T13:39:04.366400Z

I really like it and I can totally see myself using it constantly next to my repl. I wonder what was the story with ClojureScript? Moreover, I wonder if we could add a few pixel in horizontal padding. Then finally, what are the possibles shortcut to navigate inside the reveal window? I think the simple navigation from vim/emacs would be great (`n` for next, p for previous, and q for exiting the result panel). Moreover, when you press enter to see additional views on an output in reveal, does it make sense to auto-complete with the single choice available?

vlaaad 2020-12-13T14:11:50.366900Z

Hi! I'm very much interested in feedback and questions!

vlaaad 2020-12-13T14:12:44.367100Z

What do you mean about the story with clojurescript?

vlaaad 2020-12-13T14:13:45.367300Z

Re padding: can you show me where you need it and why?

vlaaad 2020-12-13T14:15:49.367500Z

About navigation and shortcuts: I'm planning to make controls configurable, so you'll be able to customize keyboard shortcuts to be however you want.

vlaaad 2020-12-13T14:18:22.367700Z

I'm not sure I understand the question about action popup with single option... The text input there is not only an autocomplete filter, it also acts as a way to evaluate arbitrary code on selection, which means it should be there no matter the amount of actions available for particular object

vlaaad 2020-12-13T14:19:01.368Z

I'm glad you like Reveal šŸ˜Š

2020-12-13T17:01:43.375600Z

For ClojureScript: how does it work when you start a ClojureScript repl? Can you also use reveal with it? For the padding, if you evaluate (tap> 3) you see the 3 is glued to the left of the output panel, I had some trouble to read it, so having a small space might help. Thanks for the keyboard customization! As for the context menu, say you (tap> {:x 3}) and enter the context menu and desire to select view:bar-chart. At the beginning you have three choices, and if you start typing view:bar then you only have a single choice left, so I would expect by hitting tab to complete it (not to scroll down and hit enter).

Dane Filipczak 2020-12-13T18:19:39.384500Z

Iā€™m trying to integrate reveal into whatā€™s potentially an unsupported setup, but wanted to see if anyone can see a way forward or an alternative. The application Iā€™m trying to connect to is running in docker and I typically use a remote nrepl to talk to it. After adding reveal to the n-repl middleware, I get an error about not finding libx11 when trying to call reveal/ui. This seems pretty reasonable, as docker wouldnā€™t have access to native libraries. My naive fix was to exec into the docker container and apt-get install libx11-dev, which seems to fix the libx11 not found problem, but the same call to reveal/ui is now throwing namespace 'cljfx.api' not found. Iā€™m able to require cljfx directly from the repl so Iā€™m not sure whatā€™s up here. Iā€™m not sure if Iā€™m close and should persist on figuring out this cljfx dependency problem, or if what Iā€™m trying to do is fundamentally unsupported / insane. Anyone successful using reveal on apps running in docker?

vlaaad 2020-12-13T18:30:01.384900Z

Does this docker container run on the same machine you use for development?

Dane Filipczak 2020-12-13T18:30:56.385100Z

yes, during the dev workflow Iā€™m interested in

vlaaad 2020-12-13T18:33:17.385600Z

it seems docker does not have the concept of graphics, but it seems to be possible to make it somehow connect to x server on your machine

Dane Filipczak 2020-12-13T18:34:10.385900Z

hmm interesting. Thanks for the lead! Iā€™ll take a look

vlaaad 2020-12-13T18:35:19.386100Z

My pleasure! If you succeed, please make a write up or post a snippet you used, it would be great to know for other people that run docker in dev

šŸ‘ 1
vlaaad 2020-12-13T18:37:32.386400Z

Regarding cljs: you can't run reveal in the same process as js because those are different languages and runtimes, so you have to do a remote connection from reveal to cljs repl, this is described here: https://vlaaad.github.io/reveal/#remote-prepl

vlaaad 2020-12-13T18:40:09.386600Z

> For the padding, if you evaluateĀ `(tap> 3)`Ā you see the 3 is glued to the left of the output panel It looks like you use reveal as a tap target? e.g. (add-tap (reveal/ui))? When using reveal repls/nrepl middleware, tapped values are shown as tap> 3 , so there is no glueing to the left.

vlaaad 2020-12-13T18:46:14.386800Z

You can use custom streaming for every tapped value, e.g. like that:

(require '[vlaaad.reveal :as reveal]
         '[vlaaad.reveal.ext :as rx])

(add-tap
  (comp
    (reveal/ui)
    #(rx/stream-as-is
       (rx/horizontal
         (rx/raw-string "=>" {:fill :util})
         rx/separator
         (rx/stream %)))))

vlaaad 2020-12-13T18:47:04.387Z

This will show every tapped value as a "result", so it will look like that:

=> 1
=> 2
=> {:a 1}

vlaaad 2020-12-13T18:48:01.387300Z

I think it's nice since it doesn't have any glueing and beginning of every value is clearly denoted

seancorfield 2020-12-13T20:21:38.387600Z

This is pretty similar to what you need when running Clojure/Reveal on WSL2 on Windows. You need VcXsrv (Xlaunch) running on Windows right now for X11 UI apps running on WSL2 to be able to display. I use VS Code on the Windows side with the Remote WSL2 extension so everything runs on Ubuntu (under WSL2) and when I start Reveal on Ubuntu, the UI starts on Windows via VcXsrv.

seancorfield 2020-12-13T20:22:45.387800Z

It usually spits out a warning or two about graphics libraries (something about Prism) but it works well enough.

Dane Filipczak 2020-12-13T20:47:32.388Z

thanks for the pointers yall! Iā€™m able to connect to docker graphics via xquartz, but Iā€™m still not quite able to get cljfx to load. When calling reveal/ui, it does a requiring resolve of cljfx/api, which throws

Syntax error (UnsatisfiedLinkError) compiling at (cljfx/api.clj:70:1).
no glass in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]` 
Iā€™m assuming this means that cljfx is making a call to native UI libraries on initialization that donā€™t exist in the docker container, although Iā€™m not sure. Thought Iā€™d drop it here in case itā€™s familiar to anyone. My use case is complicated by docker running within a vagrant vm (forā€¦ reasons), so after setting up the xqartz ssh fowarding and whatnot Iā€™m out of time to fiddle with this for now. Hopefully will get back to it later.

2020-12-13T20:53:43.388300Z

Thanks a lot!

vlaaad 2020-12-13T20:59:18.388500Z

can you do (import 'javafx.application.Platform) ?

Dane Filipczak 2020-12-13T21:01:12.388700Z

yes, imports without error

vlaaad 2020-12-13T21:08:11.388900Z

and then (Platform/startup #()) ?

Dane Filipczak 2020-12-13T21:16:00.389100Z

(Platform/startup #())
Execution error (UnsatisfiedLinkError) at java.lang.ClassLoader/loadLibrary (ClassLoader.java:2670).
no glass in java.library.path: [/usr/java/packages/lib, /usr/lib64, /lib64, /lib, /usr/lib]
That seems to be the proximate cause!

Dane Filipczak 2020-12-13T21:18:03.389400Z

I suppose I donā€™t understand why a similar error wasnā€™t thrown on the initial startup of the application. Is cljfx starting a second jvm?

Dane Filipczak 2020-12-13T21:22:24.389600Z

found this in cljfxapi. I suppose I will try suppressing platform initialization.

Dane Filipczak 2020-12-13T21:30:22.390Z

haha okay that certainly wasnā€™t it

Dane Filipczak 2020-12-13T21:33:34.390400Z

going to do some research and try to understand some of the principles underlying the system lib calls and why they might be failing. Thanks for your help!

vlaaad 2020-12-13T21:36:09.390600Z

no, JavaFX does not start a second vm

vlaaad 2020-12-13T21:36:54.390800Z

hard to tell what's happening... perhaps cljfx is extracting native libraries it needs, but it does not work with docker's fs?

vlaaad 2020-12-13T21:37:57.391Z

I know it extracts stuff to ~/.openjfx/cache

vlaaad 2020-12-13T21:38:41.391200Z

maybe ~/.openjfx has to be backed by a real folder in docker

vlaaad 2020-12-13T21:39:47.391400Z

on my (windows) machine, there is a glass.dll in ~/.openjfx/cache/${javafx-version}

2020-12-13T21:48:38.391600Z

so, just for sure, is it possible to have a CLJS nrepl then? Sorry for the silly question. I use shadow-cljs and I think it use a nrepl.

vlaaad 2020-12-13T22:10:31.391800Z

Shadow-cljs supports prepl: https://github.com/thheller/shadow-cljs/issues/508#issuecomment-535866881

vlaaad 2020-12-13T22:13:17.392100Z

I know Reveal supports nrepl, but I don't know how it will work with nrepl that talks to shadow-cljs environment, I'd suggest to experiment with it :)

2020-12-13T22:18:06.393200Z

I think I will check djblue/portal implementation and check if I can transport it to reveal.

2020-12-13T22:19:07.395Z

shadow-cljs sends data through web socket to its inspects, maybe we can leverage that.