calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
clyfe 2021-01-19T11:23:38.156900Z

How do I get the updated document after running a command in vscode?

const activeTextEditor = vscode.window.activeTextEditor;
const document = activeTextEditor.document;
console.log("before: ", document.lineAt(line).text.length);
await executeCommand("calva-fmt.formatCurrentForm");
console.log("after: ", document.lineAt(line).text.length);
Before and after are the same all the time. I don't get the new stuff. PS: not sure where's a good place to ask this. https://vscode-dev-community.slack.com is silent.

clyfe 2021-01-20T09:44:37.177500Z

I probably missed the async; seems it works now.

pez 2021-01-20T11:00:16.178200Z

Awesome

pez 2021-01-19T11:46:51.158500Z

This is a fine place to ask (even if I get a lot of help in that slack team, in the #vscode-extension-dev channel). I’m not sure what’s going on in your code there, but maybe you get the new document with the promise resolution? So what happens if instead of await you slap a .then(doc => … on the executeCommand call?

pez 2021-01-19T11:53:13.158900Z

I don’t know if you know, but anyway, an extension can expose an API to other extensions. So if there are functions/methods/info you want access to we can consider exposing them. It will of course need to be with great care we expose such an API, but the option is there. You can experiment with it at least by building your own Calva VSIX (I’m not sure how you would do it from the dev extension host when there are two extensions involved, or even if it’s possible).

clyfe 2021-01-19T11:59:51.159100Z

.then same story; something immutable involved with that document be nice having paredit functions exposed by extension, yes; I'll do dev thing see what gives thank you!

pez 2021-01-19T12:06:32.159300Z

Probably the promise resolves earlier than what you need.

🎯 1
clyfe 2021-01-19T15:18:48.161900Z

https://github.com/clyfe/vscode-calva-setup/blob/master/powertools/killSpaceBackward.js killSpaceBackward aka "the new backspace", takes your sexps to the finish-line directly, no more delete space by space (but we need to expose fmt fns in the extension api first - pr incoming; also: some refactoring required there)

pez 2021-01-19T15:46:53.163800Z

Just to manage expectations. We will have to think very carefully before exposing any API from Calva. PR welcome, but it will take some serious pondering on our side.

👍 1
clyfe 2021-01-19T15:47:44.164100Z

Chat https://github.com/BetterThanTomorrow/calva/issues/964.

levitanong 2021-01-19T17:18:22.165Z

Hi all, is there a way to interrupt an evaluation?

bringe 2021-01-20T18:05:50.201300Z

The printing isn't intentionally throttled, it's just that the applyEdit function of the vs code api is async and a bit slow, and if we don't ensure one prints before the previous, we get issues.

bringe 2021-01-20T18:06:06.201500Z

But anyway, I think we can clear the queue pretty easily, it's just an array

levitanong 2021-01-21T05:08:04.001700Z

It seems you've put in quite a bit of hammock time on this! Would I be correct in my understanding that repro steps are no longer necessary?

bringe 2021-01-21T17:42:50.010200Z

If you wouldn't mind creating an issue about the printing after interruption, that would be great so we can track it for later, and remember who brought it up, in case we can't repro or would like some info/help. :simple_smile:

bringe 2021-01-21T17:43:02.010400Z

Can't say I'll get to it soon though

levitanong 2021-01-22T04:16:17.041700Z

No problem! I'm in no hurry. I'll make the issue, and try to summarize what you've said here.

levitanong 2021-01-22T04:24:39.041900Z

Here it is! https://github.com/BetterThanTomorrow/calva/issues/978 Please correct me if I made a mistake anywhere

bringe 2021-01-19T17:18:46.165100Z

That's a Calva command for it you can find in the command palette

bringe 2021-01-19T17:18:53.165300Z

Search "interrupt"

levitanong 2021-01-19T17:20:43.165500Z

I tried it, but it doesn't seem to stop the deluge of stuff being written onto the output buffer 😆

bringe 2021-01-19T17:22:40.165700Z

Hmm, I think that command may not solve all situations like that. Feel free to create an issue for your situation with repro steps

bringe 2021-01-19T17:22:52.165900Z

Can't guarantee we can fix, but worth a look

levitanong 2021-01-19T17:32:36.166100Z

Thanks! I'll see first if I can find a workaround other than quitting vscode 😆

bringe 2021-01-19T17:46:11.166300Z

If it's not completely frozen you can try killing the repl at the terminal. If that doesn't work you can try the "Developer: Reload Window" command to make restarting it easier at least

levitanong 2021-01-19T18:17:21.166600Z

Got it, thanks!

clyfe 2021-01-19T20:30:06.168100Z

not sure what I broke but I can't send anything to the calva repl; tried all the tricks, downgrade, delete caches, restart...

clyfe 2021-01-19T20:31:04.168300Z

Is there a log of sorts somewhere to look at?

pez 2021-01-19T20:32:45.168500Z

What do you mean by “send to the calva repl”?

pez 2021-01-19T20:34:36.168700Z

See if the vscode dev console has any clues. (I think you access it from the Help menu).

pez 2021-01-19T20:37:10.169Z

So, the output window queues up prints and because reasons prints them quite slowly. So it can keep printing for quite long after you have interrupted a command… Maybe there is something we could do about it….

bringe 2021-01-19T20:40:44.169800Z

Calva version 2.0.152 is released with the following changes 🎉 :calva: • Fix: https://github.com/BetterThanTomorrow/calva/issues/959https://github.com/BetterThanTomorrow/calva/issues/931

clyfe 2021-01-19T20:47:22.170300Z

> console.ts:137 [Extension Host] Unhandled error: e.trim is not a function That pops when I type enter in the repl after a form

clyfe 2021-01-19T20:49:10.170500Z

> [Extension Host]% [] and that when I type a character in the repl

clyfe 2021-01-19T20:55:02.170700Z

> console.ts:137 [Extension Host] (node:11997) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead. Can't tell if it's calva where this originates

pez 2021-01-19T20:56:39.170900Z

That Buffer warning is a vscode thing, I think.

pez 2021-01-19T20:57:24.171100Z

The other ones I do not think stem from Calva. I don’t get them, at least.

clyfe 2021-01-19T20:58:32.171300Z

Buffer stuff is from Calva, by elimination. Disable calva -> no Buffer err Enable calva -> Buffer err

pez 2021-01-19T21:03:27.171500Z

It has been there since forever anyway. 😃 I probably have some other extension that causes it, because disabling Calva does not get rid of it for me. In any case it is probably not what is causing you problems.

clyfe 2021-01-19T21:06:08.171700Z

Works now, dunno why, it's the ~27th time I try...

pez 2021-01-19T21:13:15.171900Z

Super weird. And worrying….

clyfe 2021-01-19T21:17:21.172100Z

Calva works when I disable ego-digital.vscode-powertools extension. These 2 don't get along - they were this morning.

pez 2021-01-19T21:23:04.172300Z

We did release a new Calva today, see if that changed anything?

clyfe 2021-01-19T21:42:37.172500Z

same on 2.0.151; very strange; I'll try to replace powertools with something; most likely make my own extension calva-extras instead these scripts.

pez 2021-01-19T21:46:01.172700Z

Calva XO? 😃 https://en.wikipedia.org/wiki/Calvados#Grades_of_quality

pez 2021-01-19T21:47:34.173Z

Often called Calvados Extra, so just dropping the trailing s would fit the metafor.