Fork me on GitHub
#nrepl
<
2021-10-01
>
borkdude10:10:14

@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"

borkdude10:10:31

But unfortunately it doesn't work with CIDER yet.

bozhidar10:10:37

Great progress! Thanks for letting me know.

โค๏ธ 2
borkdude13:10:43

@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?

borkdude13:10:20

I can try cider-connect-cljs custom

bozhidar13:10:51

I guessing that's for the welcome prompt.

bozhidar13:10:14

Let me check.

bozhidar13:10:27

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.

borkdude13:10:19

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

borkdude13:10:51

did lumo support nREPL?

borkdude13:10:57

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

borkdude13:10:48

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

viesti13:10:12

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

borkdude13:10:32

ooooh uuugh ;)

viesti13:10:36

yeah ๐Ÿ™‚

viesti13:10:53

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

viesti13:10:15

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

borkdude13:10:28

yeah, but it does work after that

viesti13:10:39

just that you get some amount of errors

borkdude13:10:47

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

bozhidar14:10:59

I think the environment is detected via the version op.

bozhidar14:10:42

My bad - via describe, as it returns versions.

viesti13:10:56

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

borkdude13:10:57

trench worked pretty well so far btw

viesti13:10:06

and cider not too prepared that something goes wrong

viesti13:10:29

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

viesti13:10:57

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

viesti13:10:11

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

borkdude13:10:22

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

borkdude13:10:33

and probably also a different API around it

borkdude13:10:50

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

borkdude13:10:25

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

viesti13:10:12

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

borkdude13:10:35

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

viesti13:10:39

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

viesti13:10:45

yeah, just typed away

viesti13:10:49

anyway, neat things

borkdude13:10:59

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

viesti13:10:06

yup ๐Ÿ™‚

borkdude13:10:49

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

borkdude13:10:08

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

borkdude13:10:18

@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

viesti13:10:35

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

viesti13:10:08

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

viesti13:10:56

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

borkdude13:10:16

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 :).

bozhidar14:10:43

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.

viesti13:10:57

I don't remember how I checked babashka nrepl server

viesti13:10:28

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

bozhidar14:10:23

We need similar code in CIDER for nbb:

bozhidar14:10:25

(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)))

bozhidar14:10:31

Should be relatively simple IMO.

viesti15:10:52

aah, neat!

viesti15:10:21

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

borkdude21:10:27

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

borkdude21:10:49

Actually both for #calva and CIDER/emacs

borkdude21:10:42

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

๐Ÿ‘ 1