calva

Wednesdays you might find @U0ETXRFEW in the Gather Calva space. Invite is https://gather.town/invite?token=GZqrm7CR and the password is `Be kind`.
seancorfield 2021-02-05T00:00:44.188Z

Using ctrl right/left for sexp nav feels better because it's closer to the backward up/forward down sexp nav (ctrl up/down).

pez 2021-02-05T00:04:26.188200Z

Indeed. The reason we changed away from that on Mac is that by default MacOS binds those to some Mission Control stuff.

pez 2021-02-05T00:05:41.188400Z

I would change mine back if it wasn’t that I think I should be dog feeding the Calva defaults.

pez 2021-02-05T00:07:26.188600Z

(And I am confusing things, on Mac ctrl+left/right actually used to slurp/barf.)

Tomas Brejla 2021-02-05T00:17:54.188800Z

Good news is that it seems to be working nicely now with the VSIX version. Bad news is that it's 1:17AM, so it's time to get some sleep 😄 Thanks for your help!

❤️ 1
chucklehead 2021-02-05T01:57:00.189100Z

thanks, hadn't looked into this yet, I'll have to give it a try

lread 2021-02-05T02:52:31.189300Z

If you like vim style editing, it is familiar.

Janne Sauvala 2021-02-05T07:16:43.189500Z

@pez what do you use to launch Reveal as part of your repl start?

pez 2021-02-05T07:23:14.189700Z

pez 2021-02-05T07:25:16.189800Z

I have this alias in my deps.edn and select it at jack-in:

:reveal
  {:extra-deps {vlaaad/reveal {:mvn/version "1.2.185"}}
   :jvm-opts   ["-Dvlaaad.reveal.prefs={:font-size,17}"]
   :main-opts  ["-m" "nrepl.cmdline"
                "--middleware" "[vlaaad.reveal.nrepl/middleware,cider.nrepl/cider-middleware]"]}

Janne Sauvala 2021-02-05T07:28:48.190Z

Thanks, I decided not to use the middleware since I felt it was a little too chatty to print everything to Reveal 🙂

pez 2021-02-05T07:57:15.190700Z

This custom command definition also works (for me, yeah, I know the saying 😄).

"calva.customREPLCommandSnippets": [
        ...
        {
            "name": "Start Reveal Tapper",
            "snippet": "(require '[vlaaad.reveal :as reveal])(add-tap (reveal/ui))",
            "key": "sr"
        },
        ...
    ]

pez 2021-02-05T17:50:41.191200Z

Do you want keyword definition look-up and stuff? Time to upgrade Calva, because v2.0.160 has these changes: • https://github.com/clojure-lsp/clojure-lsp/releases/tag/2021.02.05-03.05.34https://github.com/BetterThanTomorrow/calva/issues/1016

2
🎉 1
2021-02-05T19:25:03.193400Z

Hey everyone, can I get a recommendation for either a Calva doc page or some other reference material? I'm pretty new to Clojure and the REPL in general. So far I've used Calva for faily basic stuff: cd into project, start repl, develop, etc. I've heard, however, that you can jack in to running REPL processes. This could be used to diagnose or do hotfixes to a production app. Another use case for jacking in to a remote REPL is for apps which are hosted in a VM (Docker, Vagrant, etc.). So ... uh, where do I start if I want to do something like that 😅

pez 2021-02-05T20:00:52.198300Z

It's not specific to Calva, really, but we have a Connect to a REPL command. What's important for Calva then is that the host program has an nrepl server running, and even better if it has cider-nrepl middleware loaded.

bringe 2021-02-05T20:28:51.198400Z

Check this out: https://github.com/clojure/tools.nrepl#embedding-nrepl-starting-a-server You can embed an nrepl server in your application. Say it's a web server backend/api - you can run an embedded nrepl server, and then when it's running, you can use the host:<port-you-started-embedded-nrepl-server-on> with Calva's connect command to connect to it. Then you are inside your running web backend/api. You can require namespaces from it, redefine an endpoint handler, etc.

seancorfield 2021-02-05T20:32:03.198800Z

@andyfry01 Something else to consider: any Clojure process can start a Socket REPL at startup just by specifying a JVM option -- which means you do not need any code or dependencies in your process at all -- and then you can connect to that socket server via telnet, nc (netcat), or from your editor if you use a plugin that understands plain socket REPLs (Clover for VS Code, Chlorine for Atom). Calva cannot currently connect to a socket REPL though.

seancorfield 2021-02-05T20:32:50.199Z

We run socket REPLs in many of our processes, even in production, because all it needs is a JVM option at startup...

seancorfield 2021-02-05T20:33:36.199200Z

(at some point, nREPL should be able to be "side-loaded" over a socket REPL, and then Calva could use that approach to connect to a socket REPL and "upgrade" it)

bringe 2021-02-05T20:34:15.199400Z

☝️

bringe 2021-02-05T20:37:05.199600Z

To give you an example usage, clojure-lsp, which Calva runs to provide some language features, starts an embedded nrepl server: https://github.com/clojure-lsp/clojure-lsp/blob/ca37bfff980c1c4bc504527aeeebdd965e6c3a0a/src/clojure_lsp/nrepl.clj#L16 If we want to poke around in the running clojure-lsp program, we can run the Calva command "LSP Server Info", take the :port value from the map returned, which is the nrepl server port, and use Calva's connect command to connect to it. Then we can navigate clojure-lsp's namespaces, check it's state, run functions ourselves to debug things, etc.

bringe 2021-02-05T20:38:04.199900Z

Speaking of, this :port is now coming back as nil @ericdallo 😄. It was working a while back, and I see the nrepl code was moved around at some point lately.

ericdallo 2021-02-05T20:41:00.200100Z

yeah, this is on purpose, we only show the port if you compile it with lein with-profile debug bin

ericdallo 2021-02-05T20:41:49.200300Z

this is to reduce image size, (also it doesn't work for graalvm compiled images, which should be the default soon)

bringe 2021-02-05T20:42:44.200500Z

Ah ok, thanks!

2021-02-05T20:43:51.200700Z

Great, thank you everybody! I think I've got a better grasp on what I need to do now: 1. embed nrepl into project 2. connect to repl via Calva 3. ??? 4. profit

bringe 2021-02-05T20:49:12.200900Z

#3. Run code to change/run project code

(require 'my-project.core)
(in-ns 'my-project.core)

(some-core-fn "test-args")

@app-state

bringe 2021-02-05T20:49:33.201100Z

Something like the above. I'm not guaranteeing that is correct code lol

pez 2021-02-05T22:05:46.203300Z

Dear Calva friends. The Calva team just started AMA:s at both ClojureVerse and Reddit. Please feel invited! • Reddit: https://www.reddit.com/r/Clojure/comments/ldiafr/we_created_and_maintain_calva_ask_us_anything/ • ClojureVerse: https://clojureverse.org/t/we-created-and-maintain-calva-ask-us-anything/

3