BetterThanTomorrow / calva

Clojure & ClojureScript Interactive Programming for VS Code
https://marketplace.visualstudio.com/items?itemName=betterthantomorrow.calva
Other
1.61k stars 213 forks source link

Drag sexp forward/backward works unexpectedly when ignore forms are adjacent to form the command is called on #2164

Open bpringe opened 1 year ago

bpringe commented 1 year ago

Case 1

#_hello
(:hello world)| 

Drag sexp backwards

#_(:hello world)
hello

The same seems to happen in reverse with the above case (using drag sexp forwards with (:hello world) at the top).

Case 2

#_{:clj-kondo/ignore [:unresolved-symbol]}
(:hello world)|

Drag sexp backwards

(:hello world){:clj-kondo/ignore [:unresolved-symbol]}
#_

Case 3

(:hello world)
#_{:clj-kondo/ignore [:unresolved-symbol]}|

Drag sexp backwards

(:hello world)
{:clj-kondo/ignore [:unresolved-symbol]}#_
bpringe commented 1 year ago

I was thinking that maybe it's hard to treat the #_ as part of the form it follows, since you can also use many #_s before a single form to ignore many. Case 1 acts as though #_ is its own form, which could make sense given what was just mentioned, but case 2 and 3 are still odd.

PEZ commented 1 year ago

Thanks! Looks weird indeed, and is tricky indeed. Essentially I have been thinking about it like you do there: as if #_ is its own form. So Case 1 is expected, even if maybe not optimal.

PEZ commented 1 year ago

Case 3 is fine if #_ is considered its own form, isn't it?

bpringe commented 1 year ago

Ah, you're right! I didn't realize that before.