calva

weavejester 2025-06-09T11:53:47.690229Z

Does Calva have support for the "reloaded" workflow, in the same way Cider does (e.g. https://docs.cider.mx/cider/usage/code_reloading.html)?

pez 2025-06-09T13:28:29.397619Z

I don’t know much about Reloaded, but I think that the commands mentioned in that articles correspond to Calva’s Calva: Refresh Changed Namespaces, and Calva: Refresh All Namespaces. There is no immediate support for specifying before and after functions, but could be achieved using keybindings and the VS Code runCommands command.

pez 2025-06-09T13:30:05.583069Z

Keybindings can not be saved with the workspace in VS Code, so it is not super convenient to share. We could consider adding the before and after support into Calva instead.

dpsutton 2025-06-09T13:30:22.047029Z

> You can define Clojure functions to be called before reloading, and after a successful reload, when using cider-ns-refresh: these functions are configured in elisp so may not automatically be implemented on the calva side. the basic refresh stuff is in the middleware so presumably orchard powers both in calva and cider

pez 2025-06-09T13:32:23.091599Z

In VS Code we would configure them as settings in JSON, as well as letting the commands take arguments that can be provided by keybindings or Joyride or similar.

pez 2025-06-09T13:36:30.385519Z

I guess it depends a bit on what’s the background to your question, @weavejester. If it is for your own use, then I can show you how to configure keybindings for it. It is more general, how to advice others, then I think we should consider making a few changes to Calva. There is also the clj-reload library that I have been intending to check out more closely.

weavejester 2025-06-09T14:10:03.197339Z

Apologies for not including the context. I'm writing a system that uses a custom CIDER/nREPL start script, and has some functions for starting and stopping services. I'd like to ensure that when a user opens a project using this system in Calva, they have keybindings to jack-in and reload the system (e.g. stop, refresh namespaces, start). Emacs has a .dirlocals.el file that you can use to add project-specific configuration. In this case I'd use it to give CIDER the jack-in script and the refresh functions. This means that a user can open the project and use the standard ways of connecting and refreshing without knowing the details. I'm not familiar with VS Code or Calva, but I was exploring a way of doing the same. To provide some project-specific configuration that would allow Calva users to connect/reload with a keypress.

pez 2025-06-09T14:48:29.556519Z

That’s what I mean by that we’ll need to configure those before and after functions. I can fix that. It is time.

pez 2025-06-09T19:41:57.279789Z

Latest Calva now supports configuring the refresh commands with the functions. https://clojurians.slack.com/archives/CBE668G4R/p1749497810183999 Calva Jack-in is pretty configurable, @weavejester, https://calva.io/customizing-jack-in-and-connect/ let me know if you want help with configuring the project for Calva users.

weavejester 2025-06-09T20:04:10.207279Z

Many thanks!

🙏 1
pez 2025-06-09T19:36:50.183999Z

Dear Calva friends: https://github.com/BetterThanTomorrow/calva/releases/tag/v2.0.519https://github.com/BetterThanTomorrow/calva/issues/2862`before`https://github.com/BetterThanTomorrow/calva/issues/2862`after`https://github.com/BetterThanTomorrow/calva/issues/2862 Now there are settings for configuring the refresh commands to call functions before and after refresh.

🎉 1