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? 😄
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.
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
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.
Thanks a lot, will give it a shot
@zulip-mirror-bot has joined the channel
@logbot has joined the channel
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?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 anythingThe 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.
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?
Lookie here:
Ooo, how’d you get that?
The way I speculated in the message above that image. 😃
amazing
import * as vscode from 'vscode';
export const registerDocumentSymbolProvider = vscode.languages.registerDocumentSymbolProvider;
😃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
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
I don't think VS Code has that API. But Calva could expose what it is using for it.
Strange. Yeah, I guess that’s a decent workaround, though it’d make the comment mark thing harder to use across languages.
It's an old friction point in the VS Code API 😃 https://github.com/microsoft/vscode/issues/580
Actually, I didn't test the provider well enough. It still creates a separate group.
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.
That seems right, looking at the groups they’re titled by extension name
I managed to do this 😂
https://c.tenor.com/LLLJYVQJNVAAAAAC/chefs-kiss-french-chef.gif
We could expose this register function as an API on Calva. Then we should get the proper merge, unless the docs are lying.
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.
Yes. It’s towards the question about how to use the REPL for Joyride code while connected to a project.
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.
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.
That seems to be about sending code to Joyride not the project REPL?