Fork me on GitHub
#calva
<
2024-03-29
>
gtbono00:03:57

hey folks! what are your strategies for reloading code to the REPL? I personally have a snippet of code that uses tools.namespace to refresh all my changed code, which I setup to a hotkey so I execute it before running tests, or executing code to REPL

{
        "key": "alt+l",
        "command": "runCommands",
        "args": {
            "commands": [
                "workbench.action.files.saveAll",
                {
                    "command": "calva.runCustomREPLCommand",
                    "args": {
                        "ns": "user",
                        "snippet": "(require 'clojure.tools.namespace.repl)(clojure.tools.namespace.repl/refresh)",
                    }
                }
            ],
        },
        "when": "calva:connected"
    },
what do you guys usually do?

seancorfield00:03:19

I don't find a need for that. I eval every single change as I make it, often without even saving the file, so the REPL stays up to date. I see a lot of people get into trouble with reload/refresh workflows (blowing away namespaces that don't actually get reloaded again for weird reasons) -- and you really don't want to do this while you have an application running via your REPL since it'll kill all the state.

seancorfield00:03:35

I have a hot key bound to some code that will "zap" just the current namespace so I can re-eval just that one file with ctrl+alt+c enter -- but even that I only use very rarely. https://github.com/seancorfield/vscode-calva-setup/blob/develop/calva/config.edn#L121-L140

seancorfield00:03:24

That repo has all my custom REPL snippets and my Joyride scripts, and fairly up to date key bindings and overall settings.

seancorfield00:03:28

There's also some stuff in my https://github.com/seancorfield/dot-clojure repo for Portal / clojure.tools.logging integration and starting a REPL with whatever middleware is on the classpath.

Thierry08:03:06

Same here, I eval every change make with

ctrl + alt + c enter

Tobias Gerdin09:03:23

I mostly use Integrant and have a hotkey bound to (integrant.repl/reset). Sometimes I just eval defun's o the fly with alt-enter when that will do.

Yuner Bekir11:03:31

Is there a way to edit the printing style outputted to the repl? I noticed recently that when using prn a ; is always placed before the output

pez11:03:42

There’s a setting to opt out of that protection. See https://calva.io/output/#about-stdout-in-the-repl-window

Yuner Bekir11:03:28

Thanks ❤️