babashka / nbb

Scripting in Clojure on Node.js using SCI
Eclipse Public License 1.0
863 stars 52 forks source link

nrepl server returns lacked response for multiple form evaluation #294

Closed liquidz closed 1 year ago

liquidz commented 1 year ago

version

1.1.156

platform

macOS 13.1 node v16.15.0

problem

nrepl server returns lacked response for multiple form evaluation

repro

expected behavior

nrepl/nrepl returns the following three responses (spaces are added for visibility)

d 2:ns 4:user 7:session 36:8a6073e3-4183-47e5-bf4e-d5b96adadbae 5:value 1:1 e
d 2:ns 4:user 7:session 36:8a6073e3-4183-47e5-bf4e-d5b96adadbae 5:value 1:2 e
d 7:session 36:8a6073e3-4183-47e5-bf4e-d5b96adadbae 6:status l 4:done e e

Steps to confirm expected responses:

borkdude commented 1 year ago

Can you also include the forms that are evaluated normally in the REPL? This is easier for me to reproduce than to look at the bencode directly :)

liquidz commented 1 year ago

Sure!

d2:op4:eval4:code3:1 2e

Forms are 1 2. But these forms may be treated separately in the REPL, so I could not reproduce this problem in the REPL...

borkdude commented 1 year ago

So are you not typing the code in the REPL but talking to an nbb nREPL server programmatically?

liquidz commented 1 year ago

Right. I have tested my nREPL client with nbb's nREPL server and noticed a difference with clojure's nREPL server. https://github.com/liquidz/deno-nrepl-client/blob/fbdeb7411734b53d5f4bfffdb814a43fd097dd8f/integration_test.ts#L85-L89

borkdude commented 1 year ago

Thanks, makes sense. The babashka nREPL server does work correctly, right?

liquidz commented 1 year ago

bb nrepl-server returns correct three responses as same as clojure!

d 2:id 7:unknown 2:ns 4:user 7:session 4:none 5:value 1:1 e
d 2:id 7:unknown 2:ns 4:user 7:session 4:none 5:value 1:2 e
d 2:id 7:unknown 7:session 4:none 6:status l 4:done e e
borkdude commented 1 year ago

I've been looking into a solution but it will take a little longer before I have a good solution

borkdude commented 1 year ago

Work in progress in this branch: https://github.com/babashka/nbb/compare/nrepl-multiple-exprs nREPL works, but have to clean up

borkdude commented 1 year ago

Publishing as 1.1.158