Dear Calva friends: calva https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.537 • https://github.com/BetterThanTomorrow/calva/issues/2949, contributed by @max.r.rothman • Fix: https://github.com/BetterThanTomorrow/calva/issues/2924, contributed by @arthurfucher Thanks for helping with improving Calva! 🙏 ❤️
Is there any way to hook into repl command completion? For example, it'd be nice to be able to get a notification when a test run triggered through the calva test runner completes, or when a really long eval finishes. I'd be willing to build it myself in joyride if there's something I can hook into.
Please file an issue. We can iron out some details there.
Oh, that’s great! Assuming that event also gets called when test runs complete, all that’s missing then is an event when code is evaluated. I’m thinking of this as being a parallel feature to vecode’s new task notifications: if the evaluation has been running for longer than some amount of time, then a notification is sent when it completes
There’s no concept of request/response in that log. But if we made a similar log of the nrepl messages, which have timestamps and ids, op names and such nice things. Then you could build the feature on that. BTW, it sounds like a feature we could consider for Calva, but nice with prototyping it as Joyride script first.
I don’t know if you have had a look at that log, but you can enable it with a Calva command and see what goes back and forth.
So it sounds like there would be 2 ways to do this: 1. one callback when evaluation completes that has runtime data in it 2. Two callbacks, one when evaluation starts and another when evaluation completes. Since evaluations can’t run in parallel, you could figure out runtime behind the scenes Wrt adding this to calva: I personally would want system notifications for these so they’d show up when vscode was backgrounded. Vscode does not have any APIs that send system notifications, and it seems like they’ve been reticent to add such an api. You can do it by hitting system apis yourself (or using a library that does) but I worry that that would be an overreach for Calva.
I think evaluations in different sessions can go in parallell. Currently we only support two sessions (clj and cljs), but that hopefully changes at some point.
Oh, that'd be fine as long as there was some way to figure out which session the callback came from
Option 1 definitely makes it easier to implement the notification feature, not sure about impl difficulty in calva
The nrepl log has session ids.
So what's the next step? I guess one of those two options above has to get picked?
My suggestion is an API like the Calva output API, but with nrepl messages. It will hit the callback for every message, wether it is something sent or something received. On top of this the API consumer can then build whatever schemes, including option 1 or 2.
Ah so no timing data in the completion messages, and unify both callbacks into a single one?
Not sure I follow?
I reread the messages and I think I understand now, please ignore my previous message 🙊 Ok so what’s the next step? Should I file an issue? I could maybe look at contributing this feature but I’m not sure I’ll have time until December.
We should have this. Let’s discuss what it should be like.
The closest you get today, is to subscribe to output updates, but you’d only learn when any evaluation completes, so I don’t see how you could build something from that. https://calva.io/api/#replonoutputlogged