Fork me on GitHub
#portal
<
2022-06-16
>
andyhorng01:06:09

Is there a way to get the last active selection on the Portal UI without using the atom returned from "p/open"?

seancorfield01:06:22

Do you mean via something like Joyride in VS Code? Or do you mean via code hosted on the JVM?

andyhorng01:06:51

I mean code hosted on the JVM

seancorfield01:06:55

For the latter, I don't think there's any way except via the atom. Is that a problem?

👌 2
seancorfield01:06:41

I currently have this custom REPL snippet in VS Code to start Portal: https://github.com/seancorfield/vscode-calva-setup/blob/develop/settings.json#L242 -- and that creates dev/portal which can be accessed by any code on the JVM

👍 2
andyhorng01:06:28

Because I use vagrant for my development and normally I will ssh into the vm. If I use the p/open, it will not pop up correctly.

andyhorng01:06:44

I normally access the portal UI from browser by typing URL directly (something like vagrant.mydev:8080)

djblue01:06:47

Not currently, but I wonder if portal exposed some thing like p/sessions so you can get all the active sessions :thinking_face:

djblue01:06:00

then deref any of them

djblue01:06:58

I think one thing I need to add is setting up a session automatically when hitting the ui directly

andyhorng01:06:15

yup, that's one way that I am thinking of

djblue01:06:40

Do you want to give it a shot? Not sure when I'll get to it

andyhorng01:06:12

yes, I am interesting to do that

djblue01:06:08

Sweet, let me know if you run into any issues :thumbsup:

👍 2
andyhorng01:06:17

I will find some time to implement. thanks!

seancorfield01:06:19

@UNKNGH2EL I'm curious why you run your dev env in a VM? I see this pop up from time to time here (on Clojurians, not #portal) and people are nearly always running into problems with it and the responses are typically "all you need is a JVM" and your REPL etc is already "virtualized"...

seancorfield01:06:29

I use Docker to run services that my code needs, but I always run my REPLs on the host machine, using just a JVM (and a Clojure CLI install -- but for work, that's part of our repo so that we can guarantee a fixed version for all devs and all tiers).

andyhorng02:06:30

I have many different projects running with many different stacks, I found if I keep all stacks on the host, eventually it will get bloated easily. But you're right, I found this causes many problems and I am thinking how to redesign my dev env.

seancorfield02:06:44

Everything I work on is JVM-based -- but I suspect if I had to work with certain other stacks, I might resort to VMs for them 🙂

andyhorng02:06:29

Maybe the best solution is I should focus on one project only. (I will choose Clojure) 😊

andyhorng08:06:59

Cool! Thank you!

practicalli-johnny07:06:32

Has anyone created some Portal magic with Neovim, specifically https://github.com/Olical/conjure? It would be great to be able to send some / all of the evaluation results from Conjure to Portal (without having to explicitly wrap forms and expressions in tap> in the source code. I usually start Portal automatically by adding it to the user namespace (in a dev/user.clj file) but then I have to wrap code in a tap> expression each time (unless I have missed something obvious). Ideally it would be great to have a key binding that works like the cider inspector, where I can eval something and send the result to portal as well. It would also be good to toggle a state where every expression evaluation is sent to portal (but I have a lot to learn about hacking neovim / lua / fennel before I know how to do that myself)

djblue15:06:35

I haven't seen anything but you could try the https://github.com/djblue/portal/blob/master/src/portal/nrepl.clj#L1 middleware and see if it works for your use case :thumbsup:

practicalli-johnny16:06:13

Ah, that does seem promising. Thanks. I used something a bit like that to send Cider evals to Cognitech REBL successfully. I will give this a try at the weekend (or whenever the UK heatwave is over)