Fork me on GitHub

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?


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.


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


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


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.


They haven’t been changed in ages, iirc.


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


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.


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.



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


Please file an issue, @U01SX4U5LUA


Thanks for investigating, @jr0cket!


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:


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

calva 2

Me too, thanks @U0ETXRFEW!

calva 4

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