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?
This vsix file fixes it as far as my needs are concerned. Thanks for looking at this so quickly.
Me too, thanks @pez!
Maybe @jr0cket knows if there is something that can be done about this ^ ?
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
@pez 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 @kiran.joshi should raise an issue to see if there is a way to resolve this.
Indeed:
vscode.workspace.applyEdit(wsEdit).then((_v) => {
editor.selection = selection;
});
I wonder why I thought that was a good idea…Please file an issue, @kiran.joshi
Thanks for investigating, @jr0cket!
Thanks both. Issue filed https://github.com/BetterThanTomorrow/calva/issues/1131.