Fork me on GitHub
#calva
<
2021-04-18
>
kj12:04:48

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-johnny14:04:45

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-johnny14:04:26

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

practicalli-johnny14:04:29

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

pez14:04:04

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.

pez14:04:25

They haven’t been changed in ages, iirc.

practicalli-johnny14:04:58

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

practicalli-johnny14:04:02

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-johnny14:04:52

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 @U01SX4U5LUA should raise an issue to see if there is a way to resolve this.

pez14:04:32

Indeed:

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

pez14:04:43

Please file an issue, @U01SX4U5LUA

pez14:04:54

Thanks for investigating, @jr0cket!

pez15:04:01

It was indeed a regression. We were supposed to restore the previous selection, since it changes when we insert the comment lines. Anyway, should be fixed in this VSIX: Please help test it: https://12985-125431277-gh.circle-artifacts.com/0/tmp/artifacts/calva-2.0.190-1131-eval-to-comment-decoration-f5fdb6f7.vsix

practicalli-johnny17:04:02

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

calva 2
kj08:04:43

Me too, thanks @U0ETXRFEW!

calva 4
pez12:04:56

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