calva

Max 2026-02-18T15:46:14.965109Z

While y'all are on a roll of fixing things that have made me slightly annoyed for years (🙏thanks2gratitude-thank-you), here's another one. Happy to file an issue if it's issue-worthy. Given this code:

;; Foo
(do foo)

;; Bar
(do bar)

;; Baz
(do baz)
Running drag sexp backward on the last form (or drag sexp forward on the second form) results in this:
;; Foo
(do foo)

;; Bar
(do baz)

;; Baz
(do bar)
I would've expected at least this (i.e. dragging ignores the comments):
;; Foo
(do foo)

;; Bar
(do bar)

(do baz)

;; Baz
Or even better:
;; Foo
(do foo)

;; Baz
(do baz)

;; Bar
(do bar)
I not infrequently have comments above forms, so when I drag them around I end up having to go back and copy paste the comments separately, or I just end up undoing and copy-pasting the whole chunk instead of dragging.

pez 2026-02-18T16:19:57.099549Z

Yeah, please file an issue. This is tricky to fix, but it is good to have it on the radar. Some people even like tricky.

Max 2026-02-18T16:23:15.035179Z

Filed: https://github.com/BetterThanTomorrow/calva/issues/3073

🙏 1
Max 2026-02-18T19:54:55.402559Z

Is there a way to show/hide specific status bar items provided by calva? My status bar is getting crowded, and I don't necessarily need the pprint or strict mode toggles there

➕ 1
pez 2026-02-19T06:48:30.106959Z

Currently it is an all or nothing thing.

Max 2026-02-20T14:03:02.602889Z

@pez per the checklist, do you need a corresponding issue for this PR as well?

pez 2026-02-20T14:17:06.182249Z

Yes, that’s how we do things. 😃 Issues tell why something should be done. PRs what was done (and possibly why it was done in some particular way). And we try to keep the changlog on the Issue level. So that it can be understood on the why level, and since issues are linked to PRs, users can also investigate code changes, should they experience some problem or wonder something that code would answer.

Max 2026-02-19T13:39:58.827399Z

Do you mind if I file an issue? I night have time for a pr too if I’m lucky

pez 2026-02-19T13:52:52.197259Z

Issue welcome. I’m not too keen on adding settings, though, so I suggest we remove the pprint status item, and possibly the strict mode toggler as well,

Max 2026-02-19T13:54:08.875069Z

Another thought: if there a way to make them individually toggleable in the status bar?

pez 2026-02-19T13:55:00.296889Z

I don’t know. If there is, I’m fine with doing it that way.

Max 2026-02-19T14:11:14.890209Z

Reading some old vscode issues, it seems like if we used the larger arity of createStatusBarItem it might make the items individually hideable

Max 2026-02-19T14:12:25.553349Z

The other option is that the returned StatusBarItem has a hide method, so we’d just have to decide what the user interaction that results in that method being called would be

Max 2026-02-19T14:12:42.708679Z

I'll test out the first approach in a bit

pez 2026-02-19T14:14:45.025979Z

Let’s hope the first approach works, because I don’t quite understand the second one. 😃

Max 2026-02-19T15:01:22.295199Z

It did! Currently all the status bar items are registered like this:

const typeStatus = vscode.window.createStatusBarItem(vscode.StatusBarAlignment.Left, 1);
To make them individually hide-able, two things need to be done: each needs to be given an id that's unique to the extension, and they need a name so you can tell them apart in the right click menu:
const connectionStatus = vscode.window.createStatusBarItem(
  'connectionStatus',
  vscode.StatusBarAlignment.Left,
  1
);
connectionStatus.name = 'Calva: REPL Connection Status';

pez 2026-02-19T15:03:05.265019Z

Sweet!

Max 2026-02-19T15:12:39.122289Z

I can do a pr if you want, though I feel like someone else will have stronger opinions on what the item names should be

pez 2026-02-19T15:19:23.136099Z

I can have strong opinions about that on the PR. 😃

Max 2026-02-19T16:52:19.945229Z

PR's up! https://github.com/BetterThanTomorrow/calva/pull/3088

🙏 1
Max 2026-02-18T02:13:28.545039Z

The new insertSemiColon command is working great! No more indent issues, and I like how by default it doesn't let you create invalid forms. I may have found a bug though: commenting out multiple selected lines doesn't seem to work quite right. For example, if you select this:

(defn foo []
  (prn "hi"))
and run the command, you get this:
;; 
(defn foo []
  ;; (prn "hi")
  )
It also loses the selection when you run the command, which seems wrong. Or is there another way to comment out multiple lines at once?

Max 2026-02-18T14:19:46.340729Z

@pez do you want a separate issue for the insertSemiColon thing I mentioned above? Same issue? Or is it expected behavior?

seancorfield 2026-02-18T14:27:48.525709Z

@pez Sorry, it was a bit late and I was tired. Here's the before, with a whole function highlighted -- and the after (Calva: Toggle line comment). Not quite sure how to describe that behavior other than "completely broken" 🙂

seancorfield 2026-02-18T14:28:57.684509Z

I mean, it does at least leave the code legal afterward but it certainly doesn't match what I would expect:

pez 2026-02-18T14:30:08.479869Z

@seancorfield well, @max.r.rothman described it as > commenting out multiple selected lines doesn’t seem to work So that’s easier to fix than that something is completely broken. And we have a fix cooking.

pez 2026-02-18T14:32:56.616399Z

@max.r.rothman I can’t reproduce the problem with the ; -binding not working. What’s bound to ; if you check the keyboard shortcuts editor?

seancorfield 2026-02-18T14:33:21.972019Z

What is Calva: Toggle line comment supposed to do that the built-in Toggle line comment command does not? Since the built-in command works "just fine" as far as I'm concerned, I assume Calva's command is supposed to do something similar but different?

seancorfield 2026-02-18T14:33:47.418909Z

(the plain ; bound to insertSemiColon is great BTW)

pez 2026-02-18T14:36:00.906379Z

The built in command produced some weird indentation, so that’s why we provide a separate command. While at it we made the command structurally aware. (But we forgot that more than one line could be selected when you toggle.)

Max 2026-02-18T14:37:54.273139Z

@pez ; is bound to insertSemiColon. Is there anything else I can do to help debug?

seancorfield 2026-02-18T14:38:02.515769Z

When I try it on different functions, I get seemingly random results. e.g., this function (which has no nesting) ends up with the body commented out (and illegal):

;; 
(defn check-all
  ;; "Wrapper for build/bin/check-all.sh for consistency in build REPL."
  ;; [params]
  ;; (run-build-script "bin/check-all.sh")
  ;; params
  )
;; 

seancorfield 2026-02-18T14:39:04.716389Z

Can you provide an example of the built-in Toggle line comment not working / messing up indentation? I'm curious now because I've never seen that happen.

pez 2026-02-18T14:42:51.488749Z

@seancorfield Yeah, totally unpredictable, because: > (But we forgot that more than one line could be selected when you toggle.) Fix is coming.

pez 2026-02-18T14:44:15.363559Z

@max.r.rothman do you have some special keyboard layout?

seancorfield 2026-02-18T14:44:59.181679Z

@max.r.rothman Ah, I guess I've never tried to use the built-in Toggle line comment command unless I have multiple lines selected -- for a single line, I would just type ; or ;; 🙂 So the built-in command worked for me because I always selected multiple lines?

Max 2026-02-18T14:45:31.557219Z

Not as far as i know. And I can tell that insertSemiColon is doing something because it has the correct behavior on eg the second line of that fn

pez 2026-02-18T14:48:07.207049Z

It is extremely rare that I use the toggle comments, but when I do, I have nothing selected. If I want to comment out a form I use #_.

pez 2026-02-18T14:49:08.576459Z

> Not as far as i know. And I can tell that insertSemiColon is doing something because it has the correct behavior on eg the second line of that fn Was that an answer to my question about keyboard layout? What’s “that fn” referring to?

Max 2026-02-18T14:49:55.447709Z

Sorry, yes in response to keyboard layout. Here's an example of insertSemiColon working correctly:

(defn foo []
  |(prn "hi"))
to
(defn foo []
  ;(prn "hi")
  )

Max 2026-02-18T14:50:11.833429Z

So clearly it is bound and doing something

Max 2026-02-18T14:50:58.582669Z

Sorry, we're having like 3 different convos in this thread 😛

pez 2026-02-18T14:55:21.000079Z

Ah, that’s very extra weird. There’s an inspect keymapping command in VS Code. Can you check if it produces the same results depending on where the cursor is in that function?

Max 2026-02-18T14:56:43.189279Z

I see this line in both outputs:

; =>  [Semicolon]

pez 2026-02-18T15:00:08.468819Z

Interesting. I see:

; =>                       shift+[Comma]
I guess it doesn’t really inspect what I hoped it would inspect.

pez 2026-02-18T15:01:27.390479Z

You could run Calva in the debugger and see if both instances hit a breakpoint inside where we handle insertSemiColon.

Max 2026-02-18T15:01:42.508169Z

Will do

🙏 1
Max 2026-02-18T15:05:22.971219Z

Well that was unexpected: when trying both scenarios in calva's debug window, they both function correctly

Max 2026-02-18T15:05:29.126869Z

so it is something with my setup

pez 2026-02-18T15:06:50.308199Z

Can you see something in the console log happening when it fails?

Max 2026-02-18T15:07:15.918539Z

Would that be in Calva Says?

Max 2026-02-18T15:09:10.443789Z

I don't see anything in there, devtools, or the Window output

pez 2026-02-18T15:09:46.083239Z

I meant the devtools.

pez 2026-02-18T15:13:26.636339Z

You could build yourself a prerelease of Calva: 1. Edit package.json and add -something-something after the version 2. npm run package-vsix-prerelease And old-school console.log debug it. First step is to see if both ; presses hit the function.

Max 2026-02-18T15:13:56.887339Z

Good idea, I tried looking for paredit.ts in devtools but it can't seem to find it

Max 2026-02-18T15:14:15.004339Z

to add a breakpoint in my live vscode window where I'm seeing the issue

pez 2026-02-18T15:15:15.200389Z

I don’t know how source maps survive the bundling.

Max 2026-02-18T15:25:08.466659Z

Oh I've got it! The behavior I reported only occurs in unsaved clj files

pez 2026-02-18T15:35:18.216759Z

Nice find!

pez 2026-02-18T15:35:25.263989Z

Issue please. 😃

1
Max 2026-02-18T15:45:40.360049Z

Filed: https://github.com/BetterThanTomorrow/calva/issues/3072

🙏 1
pez 2026-02-18T16:23:15.835419Z

> (the plain ; bound to insertSemiColon is great BTW) I have been running with this keybinding for quite a while, and realized it may be time to make it the default. https://clojurians.slack.com/archives/CBE668G4R/p1712135613844839

seancorfield 2026-02-18T02:31:41.188649Z

Not at my computer but ctrl+/ I think?

Max 2026-02-18T02:32:14.991699Z

calva now overrides that shortcut by default

seancorfield 2026-02-18T02:32:18.960779Z

That command is something like Toggle Comment

Max 2026-02-18T02:33:02.245589Z

so yeah I can trigger the toggle comment command manually through the palette, but my sense was that calva's new insertSemiColon command was supposed to handle multi-line forms gracefully

seancorfield 2026-02-18T02:39:08.404299Z

> calva now overrides that shortcut by default Ugh! The multi-line Calva toggle line comment is completely broken -- I deleted the ctrl+/ so I can easily get back the default working version in VS Code 🙂 The individual insertSemiColon bound to ; seems to work just fine for inline comments tho', I agree.

Max 2026-02-18T02:41:12.957249Z

Well, sort of. It still can create invalid forms:

|(defn foo []
  (prn "hi"))
hitting ; gives you
;(defn foo []
  (prn "hi"))

seancorfield 2026-02-18T02:42:22.592399Z

For me, that puts ; on its own line and moves the whole defn form down one line. I.e., it worked as expected.

seancorfield 2026-02-18T02:42:46.652799Z

Are you on the very latest Calva that came out today?

Max 2026-02-18T02:42:50.573929Z

interesting, I see that behavior for cmd+/ but not for ;

Max 2026-02-18T02:42:55.958829Z

yes, I just updated

seancorfield 2026-02-18T02:43:25.927869Z

Check that ; is bound to Calva's command

Max 2026-02-18T02:44:10.314939Z

it is, cmd+/ is bound to calva: toggle line comment which is a different command

seancorfield 2026-02-18T02:44:51.606099Z

Right, I disabled Calva's ctrl+/

seancorfield 2026-02-18T02:47:14.056699Z

For me, ; is bound to paredit.insertSemiColon twice with different conditions

pez 2026-02-18T06:42:37.593089Z

@max.r.rothman please file an issue about multiline connect toggle.

pez 2026-02-18T06:43:26.219729Z

@seancorfield anything more than “completely broken” you could give us? 😀