Fork me on GitHub
#joyride
<
2022-10-24
>
zimablue17:10:43

Does joyride (or calva not sure which) facilitate repl-initiated communication? Eg. the runtime decides to send a message to calva/joyride, and somewhere in calva/joyride we can write handler code?

borkdude17:10:48

This would be a question for @U0ETXRFEW

pez19:10:37

We don't have that. What's the use case? I wonder if it is Joyride or Calva that would be supporting this.

pez19:10:56

I don't think this can be used as a workaround, but I haven't tried. In Calva's https://calva.io/api/#replevaluatecode there are two callbacks, for handling stdout and stderr, respectively. Maybe (probably not) you can start a thread in the runtime (assuming it is Clojure) which prints to stdout and then use the callback. The reason I don't think this works is that I don't think we channel stdout back to the callback, once that evaluation has returned. I might be remembering this wrong, though.

zimablue20:10:06

Another personal usecase, basically having a UI where I can click things and it sends itself back, I guess portal sends things back to the repl using its own system not all the way back to calva

zimablue20:10:39

Sends itself back to vscode* I'm trying to deeply integrate my UI development with my IDE

zimablue20:10:16

I guess maybe I could open some sort of two way communications protocol in joyride, connect that to the runtime myself, then on ping from the runtime, run a command or calva API? That sounds like the most direct way to implement it without direct calva cooperation?

borkdude20:10:53

yes, you could open a socket server

borkdude20:10:09

node is available to you

zimablue20:10:13

This might be something that's much more convenient using joyride and useful for other people

zimablue20:10:34

@U0ETXRFEW could I do the reverse and instead of using customcommands in calva somehow fire the communication from vscode->calva ->joyride->runtime instead of worrying about the customcommand interface?

zimablue20:10:47

Instead of having messages go 1. vscode-->>calva--customcommand>>repl-->>runtime and in reverse 2. runtime-->>joyride-->>vscode have the first flow be vscode-->>calva--?>>joyride-->>runtime

pez20:10:07

Not quite following. 😃 But with the API I posted above you don't need to worry about custom repl commands. You can evaluate whatever code you want in the runtime from joyride.

zimablue20:10:30

Yeah that's what I was trying to ask I think, thank you

pez20:10:04

The Calva extension API has some functions for getting the current form and some few other friends you might recoginize from custom repl commands. Check the ranges part of the API on the same page.