Fork me on GitHub
#calva
<
2024-04-28
>
teodorlu09:04:01

Hi! I’ve been made aware that I can configure Calva to run a function in my REPL with a key binding, which is awesome:

{
    "key": "ctrl+alt+c alt+enter",
    "command": "calva.runCustomREPLCommand",
    "args": {
      "snippet": "(nextjournal.clerk/show! \"$file\")"
    }
  },
Is it possible to configure calva do three things after each other on one key binding press? Specifically, I’d like to bind some hotkey (eg Ctrl+Enter) to first save all open tabs, then run a function (`clj-reload.core/reload`), then run another function (`user/tcr`).

1
teodorlu09:04:59

Looks precisely like what I’m looking for. Thank you! 💯

Eric Chua20:04:11

Like to ask, how can I resolve these issues in latest vscode + calva (if not mistaken, generated by macros for hiccup).

pez06:04:48

I think there is something wrong/insufficient with the dependencies configuration in the project. Or clojure-lsp or clj-kondo are running from stale caches or something. You could try stopping clojure-lsp, and remove .lsp/.cache and .clj-kondo/.cache, then start clojue-lsp again. If that doesn’t help, it probably is something with the classpath.

Eric Chua17:04:19

@U0ETXRFEW I have deleted those 2 .cache folders and also restart the clojure lsp server (or exit vscode and open again). Same issue. How do I fix this with classpath? This only happens to hiccup.

pez18:04:47

Hard to tell without knowledge about your project (and I am far from an expert on these things.) clojure-lsp uses the project configuration to figure out the classpath. If it’s a deps.edn project it will run something like clojure -Spath …. If it’s Leiningen then it will use whatever is the lein equivalent. Or shadow-cljs if that is how dependencies and classpaths are managed. Since it is only hiccup that causes you these troubles it could be something with how that dependency is specified.

Thierry06:05:07

Aren't these squiggles caused by clj-kondo not recognizing them? If they are hiccup macros then you need a hiccup hook for them.

Thierry06:05:41

whoops, didnt see the post was a month old. slack...