Fork me on GitHub
#calva
<
2024-04-09
>
cmdrdats07:04:40

small curious issue with the Strict Prevent Unmatched Closing Bracket option - When typing something like (test {}) on typing the closing } , it indents and jumps the cursor to the start. With Strict prevent enabled:

cmdrdats07:04:04

With Strict prevent disabled:

cmdrdats07:04:59

I'm on [2.0.436] - though I was on [2.0.435] when I noticed this - I tried to update, hoping the fix got snuck in

pez08:04:26

Such fixes do not sneak in by themselves 😃 Please report on the repository. The videos are fine, but for the issue I prefer that there is also text showing the before and after situations and what you expect. We use | for showing where the cursor is. So something like so: With this text:

(a {|})
Type } Expect:
(a {}|)
Actual
|(a {})
It is much easier to follow this than figuring out what’s going on in a video. And this notation is what we use to write our unit tests so we can easily create a failing test and try to make it pass. Calva has a command for creating these textnotation (as we call them) snippets from a document. It will be printed to the output channel Calva says. What I do is that I open up a new untitled document (cmd+n) type the text there, place the cursor(s) or selection(s), then use the command.

cmdrdats08:04:49

awesome, thank you! how do you tell vscode that the new file is a clojure document so that calva picks it up?

cmdrdats08:04:15

very handy command!

cmdrdats08:04:49

(nice round number for the issue xD)

pez08:04:46

Thanks! I also celebrate when I hit those round numbers. 😃

pez08:04:36

You figured out how to set the language for the new doc, I take it, but for completeness sake if someone searches and finds this thread. There is a command in VS Code Change Language Mode, default bound on Mac to Cmd+K M. There is also a status bar item that you may or may not have active, showing the language mode, and it’s clickable.

pez08:04:00

Yes, very handy command. And it can be done in reverse too. 😃

cmdrdats08:04:07

aha! thanks - no, I was just manually typing the output into the issue, given that it's very simple.. forgot about the language widget in the bottom right corner!

cmdrdats08:04:15

how do you do mean with the command in reverse?

pez08:04:59

There’s a second command there. Please try it. 😃

cmdrdats08:04:31

haha, brilliant

pez08:04:40

It handles multiple selections/cursors.

1
rayat17:04:02

Oh yeah, I started noticing this like months and months ago, and seem to have subconsciously learned to stop typing the closing token haha. I never bothered to learn whether this was calva/clj or vsc itself, or which setting did this. Thanks for surfacing this from my memory - if no one else gets round to it first I might take a look after some the multicursor stuff I'm working on

pez18:04:10

I think the best path forward here is to remove that feature. VS Code resisted it from the beginning and we better not abuse the on-formatting provider like that. Plus, VS Code has the feature already, so no need for Calva to have a bad version of it.

1