This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-03
Channels
- # beginners (7)
- # calva (25)
- # clerk (2)
- # clj-kondo (5)
- # clojure (42)
- # clojure-brasil (1)
- # clojure-europe (10)
- # clojure-nl (1)
- # clojure-norway (14)
- # clojure-uk (3)
- # conjure (6)
- # datahike (4)
- # datomic (3)
- # etaoin (4)
- # fulcro (6)
- # graalvm (7)
- # hoplon (9)
- # hyperfiddle (6)
- # introduce-yourself (2)
- # london-clojurians (1)
- # off-topic (22)
- # pedestal (5)
- # portal (12)
- # proletarian (1)
- # releases (1)
- # shadow-cljs (9)
- # vim (9)
Are there bindable commands for changing collection types? I haven’t been able to find anything. It’s available in LSP as change-collection
, but not listed in the Command Palette nor here: https://calva.io/refactoring/.
Alternatively, if Calva doesn’t have an LSP command mapped, is there a way to pass a command through to LSP for this or any other new LSP commands?
But would be nice to have a way to send generic commands (like Emacs) as LSP create a new code/action command regularly :)
Calva has commands for rewrapping collections. Search for rewrap in the command palette. It can’t convert to or from sets though. We can probably make some mechanism for calling arbitrary clojure-lsp code/action commands.
If it’s available as a clojure-lsp command it should also be easy to add. Maybe that’s your first PR @U08TWB99B? 🙂

I think that what we should add is a command for calling clojure-lsp commands. Then users can bind keyboard shortcuts to that command with the clojure-lsp command-name as arguments.
I have discovered that I can in fact bind a change-collection
command. I only looked in the Command Palette, but forgot (or realized?) that some commands don’t show up there, but are still available in the Keybindings UI. In this case, the command is clojureLsp.refactor.cycleColl
. (I know, I originally said change-collection
but I then found cycle-coll
, which I liked better.)
Not something that is easily passed from a keyboard shortcut… Also, the command that is registered is change-coll
, not change-collection
.
I think we still need a Calva wrapper command for this. It can pass the first three args, which seem universal for all commands. Then tuck on any args passed with the keyboard shortcut.
I added sets to Calva’s built-in rewrap. https://clojurians.slack.com/archives/CBE668G4R/p1680556663047099
@UKFSJSM38 I’m trying to send the change-collection command, but I get no results:
[Trace - 11:41:30 PM] Sending request 'workspace/executeCommand - (94)'.
Params: {
"command": "change-collection",
"arguments": [
"file:///Users/pez/Projects/calva/test-data/projects/pirate-lang/test/pez/pirate_lang_test.clj",
6,
33,
"vector"
]
}
[Trace - 11:41:30 PM] Received response 'workspace/executeCommand - (94)' in 2ms.
No result returned.
Am I holding it wrong? If I send, say, introduce-let
instead, I get results and the action is performed.Awesome. Yes, that works. Interestingly enough Calva had it configured as change-coll
already. But no way to provide the argument, so not super useful. 😃
> We strongly suggest that client authors and users use these shortcuts keys when choosing to map these commands to key chords or menus
Calva can’t adhere to this advice. Things like sc
is not a valid keybinding in VS Code.
Adding the generic clojure-lsp.command
here. https://github.com/BetterThanTomorrow/calva/pull/2140 It can be used from Joyride or via keyboard shortcuts. A shortcut can look like so:
{
"key": "ctrl+alt+r s",
"command": "clojure-lsp.command",
"args": ["change-coll", ["set"]]
},
(Even though, since earlier today, Calva has a built in command for this particular feature, but anyway, it’s an example.)Do we have any way of adding middleware to a replConnectSequences
?
Would be interesting now that we need the portal Middleware for fully featured notebooks. That reminds me that I need to update the docs:sweat_smile:
Dear Calva friends, new release: https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.345: • Bump bundled deps.clj to v1.11.1.1267 • https://github.com/BetterThanTomorrow/calva/issues/2137`#{}`https://github.com/BetterThanTomorrow/calva/issues/2137