calva

Mark S 2025-03-27T19:02:55.297399Z

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

pez 2025-03-27T19:11:05.342189Z

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

Mark S 2025-03-27T19:11:44.477819Z

Thanks!

seancorfield 2025-03-27T19:40:08.503229Z

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

seancorfield 2025-03-27T19:47:04.326149Z

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.

pez 2025-03-27T20:23:21.871319Z

Ah, very cool, Sean!

pez 2025-03-27T20:27:33.205139Z

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.

Mark S 2025-03-27T20:28:39.152559Z

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

pez 2025-03-27T20:28:54.554989Z

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

seancorfield 2025-03-27T20:31:40.289509Z

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

seancorfield 2025-03-27T20:32:16.293449Z

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

Mark S 2025-03-27T20:36:30.678789Z

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

seancorfield 2025-03-27T20:47:54.467369Z

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.

Mark S 2025-03-27T20:57:04.047159Z

Oh nice that sounds awesome

pez 2025-03-27T20:58:35.230209Z

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

pez 2025-03-27T20:59:41.970519Z

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

seancorfield 2025-03-27T21:04:31.039969Z

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 🙂

seancorfield 2025-03-27T21:05:42.070509Z

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