Fork me on GitHub
#calva
<
2024-04-24
>
Ludger Solbach11:04:42

I have a big edn file containing just one line. Format Document does nothing on this file but works with other edn files (multiline, smaller). Is this the expected behaviour?

pez11:04:47

Is the problem that format document doesn’t break it up into lines? If so, that’s expected. cljfmt doesn’t do it. However, there’s zprint, which by default does this. Calva uses it for the command Replace Current form with Pretty Printed (or something like that. See if it does the right thing. Not sure if it may also sort the maps and stuff.

Ludger Solbach11:04:49

That works perfectliy! Thx.

Ludger Solbach11:04:43

Nearly perfectly, it sorts the maps, which is not desirable in my case. But resorting that is still much less effort than formatting the huge file by hand.

pez11:04:39

Please file an issue about the sorting.

Ludger Solbach12:04:38

will do it in the evening.

Jon Hancock21:04:01

Dear Calva friends, I've bee using Calva on my first real world clojure project. Love it. Now that I'm doing work in dev on my mac and in production on linux I find a need to interact with my production server. I've been able to use VS Code's remote ssh dev tool. However, that method 1) boots up the linux jvm from calva instead of connecting to a remote jvm running an uberjar and 2) VS Code starts up way too much process on the server and doesn't let those resources go for quite some time after I've disconnected. I think what I want is to skip the remote ssh in VS Code and just connect to the running repl from the uberjar. Is this possible? Any pointers?

pez21:04:08

Hi! Yes, that sounds possible. As long as the nrepl port is exposed on the machine running the repl reachable from the machine running Calva (possibly through ssh tunneling). Then you can use the Calva command Connect to a running REPL, not in your project, and fill in the host and port.

Jon Hancock21:04:43

I've tried a few things to get a compatible repl on the app running from the uberjar. Here is my deps.edn: {:paths ["src" "resources"] :deps {org.clojure/clojure {:mvn/version "1.11.2"} org.clojure/core.async {:mvn/version "1.6.681"} org.clojure/tools.logging {:mvn/version "1.3.0"} ring/ring-core {:mvn/version "1.12.1"} aleph/aleph {:mvn/version "0.7.1"} manifold/manifold {:mvn/version "0.4.2"} metosin/reitit {:mvn/version "0.7.0-alpha7"} hiccup/hiccup {:mvn/version "2.0.0-RC3"} cheshire/cheshire {:mvn/version "5.13.0"} com.github.seancorfield/next.jdbc {:mvn/version "1.3.925"} org.postgresql/postgresql {:mvn/version "42.7.3"} com.github.seancorfield/honeysql {:mvn/version "2.6.1126"} nrepl/nrepl {:mvn/version,"1.0.0"} cider/cider-nrepl {:mvn/version,"0.28.5"}} :aliases {:run-m {:main-opts ["-m" "parker.server"]} :run-repl {:main-opts ["-m" "nrepl.cmdline"]} :run-x {:ns-default parker.server :exec-fn greet :exec-args {:name "Clojure"}} :build {:deps {io.github.clojure/tools.build {:mvn/version "0.9.6"}} :ns-default build} :test {:extra-paths ["test"] :extra-deps {org.clojure/test.check {:mvn/version "1.1.1"} io.github.cognitect-labs/test-runner {:git/tag "v0.5.1" :git/sha "dfb30dd"}}}}}

Jon Hancock21:04:43

are these the correct ones: nrepl/nrepl {:mvn/version,"1.0.0"} cider/cider-nrepl {:mvn/version,"0.28.5"} also, what can I put in my app's main to ensure the repl is started? I think I can handle the ssh tunneling part. I've tried several combinations from docs and haven't hit on what works 🙂

pez21:04:31

I think that what you want to do is to embed the nrepl server in your app. https://nrepl.org/nrepl/1.1/usage/server.html#embedding-nrepl

pez21:04:09

The dependencies are fine. Though there are newer versions. Calva prints the version it defaults to for jack-in, in the Calva says output when Calva starts.

Jon Hancock23:04:17

ok,,,I've made it a bit further. I've updated the deps to match latest calva: nrepl/nrepl {:mvn/version,"1.1.1"} cider/cider-nrepl {:mvn/version,"0.47.1"} I have my app main starting the repl: (defn -main [& args] ;; start repl server (nrepl/start-server :bind "127.0.0.1" :port 6669) ;; start http server (start-server! 8080)) The local port forward seems to work. From Calva, I select "Connect to a running REPL, not in your project" I get this warnign from Calva: The nREPL server does not support cider-nrepl info op, which indicates troubles ahead. You need to start the REPL with cider-nrepl dependencies met.

pez04:04:21

I’m not sure how you embed the middleware. Maybe they can help in #C17JYSA3H. But that message is a bit scarier than it sounds. A lot of things work without cider-nrepl.

Jon Hancock00:04:36

thanks @U0ETXRFEW. I'm able to do basic stuff with this connection method: load a file, evaluate things. Thats all I really need for interacting with the product server. Would be nice to know how to improve it. I'll ask #C17JYSA3H 😉