Fork me on GitHub
#joyride2022-05-23
>
Max17:05:49

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?

Max17:05:29

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

pez17:05:57

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.

Max17:05:01

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?

metal 1
pez19:05:40

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.

Max19:05:08

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

pez20:05:58

I managed to do this 😂

👌 1
pez20:05:15

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

pez16:05:05

Lookie here:

Max16:05:14

Ooo, how’d you get that?

pez16:05:41

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

pez16:05:13

import * as vscode from 'vscode';

export const registerDocumentSymbolProvider = vscode.languages.registerDocumentSymbolProvider;
😃

pez16:05:11

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

Max16:05:40

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

pez16:05:41

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

Max16:05:30

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

pez21:05:14

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

😿 1
pez05:05:21

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

1
pez20:05:24

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.

seancorfield22:05:00

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.

pez06:05:23

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.

seancorfield06:05:08

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

pez07:05:06

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

1