Using ctrl right/left for sexp nav feels better because it's closer to the backward up/forward down sexp nav (ctrl up/down).
Indeed. The reason we changed away from that on Mac is that by default MacOS binds those to some Mission Control stuff.
I would change mine back if it wasn’t that I think I should be dog feeding the Calva defaults.
(And I am confusing things, on Mac ctrl+left/right actually used to slurp/barf.)
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!
thanks, hadn't looked into this yet, I'll have to give it a try
If you like vim style editing, it is familiar.
@pez what do you use to launch Reveal as part of your repl start?
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]"]}
Thanks, I decided not to use the middleware since I felt it was a little too chatty to print everything to Reveal 🙂
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"
},
...
]
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.34 • https://github.com/BetterThanTomorrow/calva/issues/1016
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 😅
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.
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.
@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.
We run socket REPLs in many of our processes, even in production, because all it needs is a JVM option at startup...
(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)
☝️
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.
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.
yeah, this is on purpose, we only show the port if you compile it with lein with-profile debug bin
this is to reduce image size, (also it doesn't work for graalvm compiled images, which should be the default soon)
Ah ok, thanks!
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
#3. Run code to change/run project code
(require 'my-project.core)
(in-ns 'my-project.core)
(some-core-fn "test-args")
@app-state
Something like the above. I'm not guaranteeing that is correct code lol
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/