calva
calva copied to clipboard
Drag sexp backwards command causes unexpected outcome in specific situation
(defn mirror-tree
[tree]
(when tree
(let [[root left right] tree]
[root (mirror-tree left) |(mirror-tree right)])))
When I put my cursor at | in the above code, in the bottom vector before the last sexp, and I run the command to drag the sexp backwards, it moves it to the front of the vector, rather than swapping it with the previous, as I expect.
Same thing happens if I put that code in a file by itself.
I think I know what's happening. Calva probably misidentifies this as a let binding. (Within let, and other binding forms, the drag operations drag pairs. The result when dragging when there are an uneven number of elements in the binding form is somewhat undefined.)