joyride

pez 2022-05-07T11:25:18.491499Z

Dear Joyride friends: Latest Calva uses ^ that ^ API to implement Joyride Jack-in. Here's a video showing the process from not having the Joyride extension installed until you are scripting VS Code itself. 1 minute 7 seconds, including me flailing around a bit.

2
🎉 1
pez 2022-05-07T16:50:06.003699Z

I'm looking at adding init scripts. When developing VS Code extensions you need to implement an activate(context: vscode.Extension) function, which will get called when your extension is activated by VS Code. I'm wondering a bit how Joyride scripts should access this object. Trying an API right now with a function in joyride.core that will get this object for you. Like so:

(ns hello
  (:require [joyride.core :as joyride]))

(comment
  (def context (joyride/get-extension-context))
  (.-extensionPath context)
  ; => "/Users/pez/Projects/joyride"
  )
The good thing about this is that we can skip specifying some function that the init script should have. Instead, when you need it, you just go grab it from joyride.core. An alternative is to do similar to the VS Code Extension API. Then the script author takes responsibility for tucking away the extension context object for later use.

pez 2022-05-07T16:52:03.520599Z

I like the simplicity of that your init script will just run, without any activate or main function stuff. It will be nothing special with this script other than that Joyride will run it at startup.

pez 2022-05-07T16:58:52.297829Z

Then there is the deactivation issue as well. VS Code extensions implement a deactivate() script where they can do clean-up. (E.g, Joyride uses this to stop any nREPL server that is running and delete the nrepl-port file). If the init script ”just runs” then what is a good way for this deactivation hook? • joyride.core could have a function you call for registering a function to be called. • we could have an exit script similar to the init script. Joyride ”just runs” it as part of its deactivation. • ...

pez 2022-05-07T17:01:07.642819Z

Anyone has any strong opinions against me going with the ”just run the init script” idea? Other ways to do this? How does this work in Emacs? Etcetera...

borkdude 2022-05-07T17:50:11.166329Z

@pez Emacs has an ~/.emacs.d/init.el script, I think having the init.cljs scripts in the system + workspace could be nice, but maybe wait until people have a real need for this already?

borkdude 2022-05-07T17:50:46.823559Z

We could have a de_init.clj too, but again, I would wait for requirements to appear from real usage, rather than guessing what it should be right now

pez 2022-05-07T18:59:55.697689Z

Nah, Joyride will be half-assed without init functionality. And it has already been asked for anyway.

borkdude 2022-05-07T19:00:28.533459Z

Then I would say scripts/init.cljs would be the most Emacs-ish way

pez 2022-05-07T19:49:01.355059Z

Agreed. And no main or activate or such, right? Does Emacs have something for de-init/exit?

borkdude 2022-05-07T19:50:03.756759Z

not that I'm aware of

concerned-tortoise 2022-05-07T21:39:58.134829Z

I’d like to be able to have init scripts to do things like create workspace specific vscode settings. I’m not sure if this is something that could be improved by joyride, but you could have a workspace init script that replaces vscode’s settings.json file or modifies it, and that’d be pretty cool

pez 2022-05-07T21:48:34.083679Z

There is VS Code extension API for updating settings so this would definitely be doable from an init script w/o editing the settings.json.

concerned-tortoise 2022-05-07T21:49:18.224389Z

Okay, I’m not surprised there’s an API for it, but even if vscode didn’t have one, I think init scripts would be useful for just this alone

mauricio.szabo 2022-05-07T23:46:42.025259Z

Atom's init script is also very simple - it just runs the code, and if you want to clean up things, you just restart your editor 🤣

mauricio.szabo 2022-05-07T23:49:37.355889Z

I actually would like to have a bunch of "joyride specific" APIs that wrap vscode API in a way that when you deactivate the plug-in, it auto cleanups things

2022-05-07T17:52:07.477869Z

Is their instructions for getting joyride working on windows ? I installed the extension. I created a test.cljs file, I click REPL > Start your REPL with a project and Jack-in, and then nothing happens.

2022-05-07T17:53:43.430839Z

CTRL+SHIFT+P: Joyride Run Clojure Code works just fine. I can run code and see the output in the output window

2022-05-07T17:54:29.856449Z

I reopened the folder in WSL Now when I start a repl I see this:

2022-05-07T17:54:39.166689Z

I will try reinstalling extension in WSL

borkdude 2022-05-07T17:55:37.361219Z

you need to upgrade Calva as well

2022-05-07T17:55:39.801459Z

NO, installed the exentions in wsl and still i only get option of babashka nd nbb

2022-05-07T17:56:06.400719Z

I'm on v0.0.5

2022-05-07T17:56:13.769749Z

does it not install the latest ?

borkdude 2022-05-07T17:56:17.789659Z

Calva

2022-05-07T17:56:24.941639Z

aaah sorry im dumb

2022-05-07T17:57:03.867649Z

yay! That worked, thank you!

2022-05-07T18:00:15.397939Z

Where will the user script folder be on WSL ?

borkdude 2022-05-07T18:01:14.561669Z

Probably in ~/.config/joyride/scripts at least that's what I discussed with @pez, not sure if he implemented it like that

concerned-tortoise 2022-05-07T21:41:22.483869Z

What’s the rationale to having your scripts in .joyride/scripts rather than just .joyride? Is there something else that would go in that top-level directory?

borkdude 2022-05-07T21:45:33.712089Z

E.g. the .nrepl-port file also goes into .joyride

borkdude 2022-05-07T21:46:05.763939Z

It's an arbitrary directory nesting, could be argued either way I think

concerned-tortoise 2022-05-07T21:47:29.761519Z

Ahh okay, thanks 👍