Fork me on GitHub
#calva
<
2021-04-18
>
knji12: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_john14: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_john14:04:26

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

practicalli_john14: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_john14:04:58

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

practicalli_john14: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_john14: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!

knji08:04:43

Me too, thanks @U0ETXRFEW!

calva 2
pez12:04:56

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