nrepl 2021-10-01

@bozhidar Hey. I released #nbb v0.0.82.

nbb nrepl-server :port 1337
works when you connect with lein repl :connect 1337
$ lein repl :connect 1337
Connecting to nREPL at 127.0.0.1:1337
Could not resolve symbol: nrepl.core/versionniluser=>
nil
user=> (require '["fs" :as fs])
nil
user=> (fs/existsSync "README.md")
false
user=> (js/process.cwd)
"/private/tmp"

But unfortunately it doesn't work with CIDER yet.

Great progress! Thanks for letting me know.

โค๏ธ 1

@bozhidar somehow when I cider-connect to the server, I get: It also seems to try System/getProperty which isn't available. Should I try something else?

I can try cider-connect-cljs custom

I guessing that's for the welcome prompt.

Let me check.

Ah, no. That's for the classpath. I guess we should make this conditional or something, as I doubt the classpath makes sense in nodejs.

nbb does have a classpath but it's more like CLJS (without the JVM, let's say self-hosted) than anything else

did lumo support nREPL?

it doesn't seem so but the use case would be similar

(@viesti had you tested your work with CIDER?)

I think I did, made some hacks to please it a bit ๐Ÿ™‚

ooooh uuugh ;)

yeah ๐Ÿ™‚

trying out different nrepl clients, they spew interesting things at the server ๐Ÿ˜„

like reply, which is in leinigen, sends the completion functionality on connect

yeah, but it does work after that

just that you get some amount of errors

I think CIDER tries to see what kind of environment it deals with using System

I think the environment is detected via the version op.

My bad - via describe, as it returns versions.

that "lisp expression" probably cause by cider sending stuff to eval which then throws

trench worked pretty well so far btw

and cider not too prepared that something goes wrong

yup, trench more "friendly" to non-java nrepl servers ๐Ÿ™‚

don't actually know if there should be (maybe should bad word) a kind of "handshake"

server: "Hi, server here, I'm on JVM" client: "Oh nice, let me check your classpath"

well, nbb has a classpath too, just not the System stuff

and probably also a different API around it

I pushed nbb v0.0.83 with a small fix: noticed (require 'cljs.core) was done which it failed on, this should work now

hmm, crap that particular one doesn't. just a minute

oh wau now just realised that this discussion is on #nrepl channel ๐Ÿ˜„

well, the topic is nrepl isn't it? ;)

hope bozhidar didn't get angry on the hacks I did ๐Ÿ˜„

yeah, just typed away

anyway, neat things

I think he is used to greater hack to make nrepl work... is my guess :)

yup ๐Ÿ™‚

We can go into a thread however about #nbb and nrepl. ๐Ÿงต

Yes, the babashka nrepl works great with CIDER but there was also some ironing out of details that went on there

@bozhidar So with cider-connect-cljs custom I do get a REPL buffer that works. Just the part of sending an expr to the REPL buffer doesn't work

I wonder if there could be a way to "negotiate" what the nrepl server we'r connecting to actually is. But I guess cider-connect-cljs close to what a sci over node would be

I remember trying cider-connect-cljs custom too, but I don't now remember what the problem was

probably tries to send some preamble that then fails to eval and cider is left wondering what happened

We are charting new territory here as lumo didn't even have an nREPL. I hope @bozhidar will be open to helping us out to get this thing in the air :).

Well, as long as we don't even some Clojure code from CIDER we should be good. It will require a bit more work than for Babashka, but I don't expect it will be hard to accommodate nbb.

I don't remember how I checked babashka nrepl server

just had cider connection to it a minute ago, cider seems not to panick with it

We need similar code in CIDER for nbb:

(defun cider--babashka-version ()
  "Retrieve the underlying connection's Babashka version."
  (with-current-buffer (cider-current-repl)
    (when nrepl-versions
      (nrepl-dict-get nrepl-versions "babashka"))))

(defun cider--babashka-nrepl-version ()
  "Retrieve the underlying connection's babashka.nrepl version."
  (with-current-buffer (cider-current-repl)
    (when nrepl-versions
      (nrepl-dict-get nrepl-versions "babashka.nrepl"))))

(defun cider-runtime ()
  "Return the runtime of the nREPl server."
  (cond
   ((cider--clojure-version) 'clojure)
   ((cider--babashka-version) 'babashka)
   (t 'generic)))

Should be relatively simple IMO.

now I feel dumb not asking this earlier ๐Ÿ˜„

I found out that evaluation for #nbb works fine in a .clj buffer but just not in a .cljs buffer

Actually both for #calva and CIDER/emacs

To get things rolling, I posted an issue here: https://github.com/clojure-emacs/cider/issues/3061

๐Ÿ‘ 1