calva icon indicating copy to clipboard operation
calva copied to clipboard

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

Open bpringe opened this issue 2 years ago • 4 comments

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 avatar Apr 19 '23 00:04 bpringe

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.

bpringe avatar Apr 19 '23 04:04 bpringe

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.

  • Related discussion: https://github.com/BetterThanTomorrow/calva/discussions/2125

PEZ avatar Apr 19 '23 09:04 PEZ

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

PEZ avatar Apr 19 '23 09:04 PEZ

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

bpringe avatar Apr 20 '23 23:04 bpringe