Soooo, has anyone written a fun script lately?
@pez Can users make a script to immediately launch a joyscript nrepl and be connected to it from Calva, from joyride itself?
I think it's possible, but in a quite brittle way. Calva needs to support this with an API to make it more reliable. That said, the brittle version would involve something like:
1. Register a file watcher on .joyride/,.repl-port (using the vscode/workspace.fs watcher) which
a. Issues Calva's command for connecting to a running REPL in the project
b. brittleness ahead
2. Execute Joyride's command for starting the nREPL server
If the scripts doesn't do anything on b. there, then the user can finish by submitting the prompts. If the script should do it, then a combination of
• js/setTimeOut
• executing the VS Code commands for advancing in the picker menus/prompts
• executing the VS Code commands for submitting in the picker prompts
Something like that...
Again thinking we might consider letting extensions bundle some .joyride/contributed-scripts/ folder which Joyride could offer to execute via a separate command: Run Contributed script or something.
or maybe calva could expose some extension functions to make this easier?
It's not mutually exclusive.
joyride itself can also expose joyride.nrepl so you can asynchronously wait for stuff to happen etc
I'm all for better Calva and Joyride extension API:s. The idea with contributed scripts is something else though. Even if they would also benefit from the better API support.
I’m mostly interested in the user scripts from Joyride. Because things can sometimes break in vscode when you’re using a workspace with multiple folders in it, I always make my current project the root of the workspace. This makes it a bit more of a pain when swapping between projects. I don’t want to need to swap workspaces just to write joyride scripts. So one thing that I was wondering if I can do with Joyride is create an activity bar button that displays all my user script and lets me quickly open and edit and work on them them from any workspace. Is this something that’s possible to do with joyride, or would this need to be built into the extension itself?
Sorry for late reply! This sounds super interesting. Can you post it as an idea on the Discussions of the repo, please? We can iron out the details of how this should work together there. Right now Joyride only let's you run scripts from the first workspace folder. Not sure how we can fix that with the current approach, but maybe there is a way...
Okay, after briefly looking into this, it looks like it needs to be in the extension itself because it needs to be registered through the extension’s package.json file. If this would be of interest, I’ve started looking into how to do it.