calva 2025-03-27

Is there a way to reload deps when modifying deps.edn? My current workflow is reconnecting REPL which is kinda painful at times.

If you are using Clojure 1.12 you can reload deps. I have some custom commands for it that I can share here later.

My vscode-calva-setup repo has a REPL snippet for that, which uses sync-deps added in Clojure 1.12

Update deps.edn then ctrl+alt+space a to run the snippet. It prompts for any aliases you want to sync, e.g., :test and then loads any new deps.

Ah, very cool, Sean!

I have this in user settings json

"calva.customREPLCommandSnippets": [
    ...
    {
      "key": "a",
      "name": "Add selected dependency/ies",
      "repl": "clj",
      "snippet": "(require '[clojure.repl.deps :refer [add-libs]])\\n(add-libs '{$selection})"
    },
    ...
So I select the dependency key and the coordinates and then press ctrl+alt+space a. It is neat also because I can have the dependency key and coords in a line comment in the file where I experiment with something and load the dependency.

I put the first snippit in .config/calva/config.edn and refreshed as talked about at: https://calva.io/custom-commands/#configedn it prompts for repl input. I hit enter with blank.. It returns true I think it worked. Thanks

It is probably time to implement both variants as built-in commands in Calva.

The true result comes from the tap> call. I have Portal installed and running in VS Code so I see tap> output there.

If you don't need/care about tap> just remove that call around the snippet.

Ok, I don't know what taps are. I'm new. I'll take a look 🙂

tap> is great for debugging -- like println only for data, instead of strings, and you can have multiple tap listeners. Plus it's safe to leave in production code since it's almost a no-op if there are no listeners.

Oh nice that sounds awesome

I made a silly macro for tapping let bindings. I also bundled a #t reader tag that taps anything (similar to the more famous #p which prints stuff). https://github.com/PEZ/taplet

Disclaimer: I’m an inline def guy, rather than a tapper, so I haven’t really used those very much.

I have a REPL snippet to def bindings from let -- you have to select the symbol and the expression (but with shift+alt+right for expand selection, that's easy), then ctrl+alt+space d. And ctrl+alt+space i to def the currently selected symbol to some REPL input (prompts for the value). Calva really helps you build quick and flexible debugging, using the core language 🙂

(and ctrl+shift+t t and ctrl+shift+t space for tap> current form and tap> top-level form)