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`.
kj 2021-04-18T12:26:48.072300Z

I'm new to Clojure and have been giving Calva a try with VSpaceCode. Whenever I do "evaluate top-level form as comment" (`, e ;` in VSpaceCode) I end up in Vim Visual mode after the comment has been pasted. Is there a setting I can update so that evaluate top-level form as comment leaves me back in Normal mode?

practicalli-john 2021-04-19T17:38:02.079200Z

This vsix file fixes it as far as my needs are concerned. Thanks for looking at this so quickly.

1
kj 2021-04-20T08:52:43.093800Z

Me too, thanks @pez!

1
pez 2021-04-18T12:54:56.073700Z

Maybe @jr0cket knows if there is something that can be done about this ^ ?

practicalli-john 2021-04-18T14:01:45.073800Z

I can replicate this. I'll check the VSpaceCode package.json file and see what function its calling. Perhaps something has changed in Calva as I dont recall that behaviour before.

practicalli-john 2021-04-18T14:05:26.074Z

Its calling calva.evaluateTopLevelFormAsComment , so not sure if there something different about that function @pez has that function changed recently?

practicalli-john 2021-04-18T14:08:29.074200Z

That function seems to have the same behaviour as calva.evaluateSelectionAsComment too, both are selecting the top level function that has been evaluated.

pez 2021-04-18T14:13:04.074400Z

They behave differently in that the first one selects the current form and the second one selects the current top level form for evaluation. If the current form and the top level form are the same, then, well the commands behave the same.

pez 2021-04-18T14:13:25.074600Z

They haven’t been changed in ages, iirc.

practicalli-john 2021-04-18T14:13:58.074800Z

Ah, so maybe its always done that and I never noticed. It does explain the behaviour I see.

practicalli-john 2021-04-18T14:16:02.075Z

Seems like the selection used by Calva keeps the form selected in VSpaceCode, e.g in visual select mode. In that case a manual press of the Esc key is required it seems, unless there is a way to send an unselect at the end of the call to that function.

practicalli-john 2021-04-18T14:25:52.075200Z

It seems strange, because the previous two functions will leave the expression selected. However, calva.evaluateSelection and calva.evaluateCurrentTopLevelForm do not leave the expression selected. I guess @kiran.joshi should raise an issue to see if there is a way to resolve this.

pez 2021-04-18T14:46:32.075400Z

Indeed:

vscode.workspace.applyEdit(wsEdit).then((_v) => {
        editor.selection = selection;
    });
I wonder why I thought that was a good idea…

pez 2021-04-18T14:46:43.075600Z

Please file an issue, @kiran.joshi

pez 2021-04-18T14:46:54.075800Z

Thanks for investigating, @jr0cket!

kj 2021-04-18T20:41:29.076100Z

Thanks both. Issue filed https://github.com/BetterThanTomorrow/calva/issues/1131.

❤️ 1