joyride

zakkor 2022-05-23T07:01:31.152659Z

Hi guys! I am looking for a way to automate all the things I need to do when freshly booting up a project, like opening terminals, and inside them navigating to dirs, running commands, etc, also running vscode commands (like Calva jack-in). I think I could use a vscode build task for this, but it's kinda not great. Could I use Joyride for this instead? 😄

pez 2022-05-23T07:06:06.789149Z

Hi! There is an example in the repo for how to open terminals. Jack-in is a bit tricky to automate with Joyride yet. There is no API for populating the menus. You can populate and skip several of the menus using Calva Connect Sequences though, so you can get pretty close to fully automated startup.

zakkor 2022-05-23T07:09:11.713169Z

Oh awesome, so if I define a custom connect sequence then the jack-in command will no longer show a menu to select which project type I want to start? My requirements aren't complicated at all, I just use the default deps.edn project with no other configuration

pez 2022-05-23T07:15:31.877989Z

Yes. Iirc there is currently no way to get rid of the first prompt where you would select the connect sequence to use, though (it is treated as a project type). But if you can make VS Code select and submit those menus. By navigating the menu, blindly and submitting. If it is only one such menu, you might get away with it.

🙏 1
zakkor 2022-05-23T07:16:06.509179Z

Thanks a lot, will give it a shot

2022-05-23T08:56:24.635689Z

@zulip-mirror-bot has joined the channel

logbot 2022-05-23T08:56:37.214569Z

@logbot has joined the channel

Max 2022-05-23T17:14:49.024049Z

While I’m jacked into a joyride repl, I see a ton of these messages in the extension host log:

[2022-05-23 13:11:55.185] [exthost] [error] [betterthantomorrow.calva] provider FAILED
[2022-05-23 13:11:55.186] [exthost] [error] The server does not recognize or cannot perform the 'undefined' operation
I’ve been able to reproduce it by evaluating a file in the joyride repl that had no global side effects (i.e. just defs/defns). Is this something I should be worried about?

Max 2022-05-23T17:16:29.434709Z

I also occasionally see some of these:

[2022-05-23 13:15:35.174] [exthost] [warning] betterthantomorrow.calva - Code actions of kind 'quickfix 'requested but returned code action is of kind 'source.organizeImports'. Code action will be dropped. Please check 'CodeActionContext.only' to only return requested code actions.
They both show up all on their own after waiting a few minutes, without me doing anything

pez 2022-05-23T17:57:57.908499Z

The first one is Calva being a bad nREPL client. No need to worry. The other one is some lsp message. Doesn’t look particularly worrying either.

Max 2022-05-23T17:36:01.127199Z

And also a bit of show and tell! From my brief stint playing with writing iOS apps, I’ve been missing the ability to use comments to group symbols in the outline especially in long namespaces. I used Joyride to throw together a proof-of-concept https://gist.github.com/maxrothman/395c078454eed5bd108d153b33107637! It didn’t quite work the way I’d hoped though, in the outline the symbols don’t show up inline with the other ones provided by Calva, so it doesn’t break up the outline as I’d intended. Anyone know if there’s a way to get VSCode to display those together?

1
pez 2022-05-30T16:37:05.391109Z

Lookie here:

Max 2022-05-30T16:41:14.672609Z

Ooo, how’d you get that?

pez 2022-05-30T16:44:41.446539Z

The way I speculated in the message above that image. 😃

Max 2022-05-30T16:44:57.137309Z

amazing

pez 2022-05-30T16:46:13.565939Z

import * as vscode from 'vscode';

export const registerDocumentSymbolProvider = vscode.languages.registerDocumentSymbolProvider;
😃

pez 2022-05-30T16:55:11.726829Z

Just need to add some docs. but you can run the VSIX from this PR to try it out: https://github.com/BetterThanTomorrow/calva/pull/1753

Max 2022-05-30T16:55:40.098649Z

While we’re on the topic, do you know if there’s a way to get the editor tokens/scopes on a range? It would’ve been nice to detect comments rather than looking for the string ;; .*. I was surprised that I didn’t see a VSCode API for such a thing, but I very well could’ve just missed it

pez 2022-05-30T16:56:41.975969Z

I don't think VS Code has that API. But Calva could expose what it is using for it.

Max 2022-05-30T16:59:30.149479Z

Strange. Yeah, I guess that’s a decent workaround, though it’d make the comment mark thing harder to use across languages.

pez 2022-05-30T21:58:14.530149Z

It's an old friction point in the VS Code API 😃 https://github.com/microsoft/vscode/issues/580

😿 1
pez 2022-05-31T05:02:21.857819Z

Actually, I didn't test the provider well enough. It still creates a separate group.

☹️ 1
pez 2022-05-23T19:32:40.555239Z

It's clojure-lsp providing the outline in Calva,.. I was expecting a script like yours to merge them, that's what the docs say should happen, but maybe it's when the same extension registers multiple providers.

Max 2022-05-23T19:33:08.517889Z

That seems right, looking at the groups they’re titled by extension name

pez 2022-05-23T20:16:58.742749Z

I managed to do this 😂

👌 1
pez 2022-05-23T20:32:15.512629Z

We could expose this register function as an API on Calva. Then we should get the proper merge, unless the docs are lying.

pez 2022-05-23T20:38:24.123739Z

There's some demand for a Calva API for evaluating code. https://github.com/BetterThanTomorrow/calva/issues/1719 The evaluation module of Calva is super messy, so we will need to do some clean up before we add external use. What would you like this API to be like? The response structure from nREPL is pretty nice to work with. And it takes reasonable inputs as well. Maybe expose those quite transparently? Asking here because it is mostly a concern for people using Joyride, I think.

pez 2022-05-24T07:00:06.613239Z

Yes. It’s towards the question about how to use the REPL for Joyride code while connected to a project.

👍🏻 1
seancorfield 2022-05-23T22:31:00.320019Z

I wrote up my use case, just to get it on record. I would be fine with even being able to run a custom REPL snippet and get a promise of the eval result (as long as that went to the project's nREPL, not Joyride's). But being able to get a text selection from the editor (or, preferably, the current form) and being able to decorate that with additional code and then submitting it for execution and getting the string result back would be my ideal.

pez 2022-05-24T06:42:23.288139Z

Regarding the question on that issue about how to hack on Joyride code while connected to a Clojure REPL I https://clojureverse.org/t/say-hello-to-joyride-the-clojure-repl-in-vs-code/8957/3 for giving yourself some Joyride evaluation commands without starting the Joyride REPL.

seancorfield 2022-05-24T06:52:08.613339Z

That seems to be about sending code to Joyride not the project REPL?