tonsky / Clojure-Sublimed

Clojure support for Sublime Text 4
MIT License
371 stars 22 forks source link

Getting stuck on "adding middlewares" #43

Closed eneroth closed 1 year ago

eneroth commented 2 years ago

I'm attempting to connect to a server hosted by Shadow-CLJS:

{:deps        {:aliases [:common]}
 :nrepl       {:port       5555
               :middleware []}
 …}

There are no error messages in the log, as I can see.

Screenshot 2021-12-14 at 10 54 57

jaihindhreddy commented 2 years ago

Please make sure you are using nrepl version 0.8 or later. I faced this issue when I used a very old version of nrepl.

eneroth commented 2 years ago

Ah, I have no idea which REPL is included in Shadow-CLJS. It might be an old one, I guess.

Edit: it seems that Shadow-CLJS is using 0.8.3.

tonsky commented 2 years ago

I have never tested with CLJS. There are a few middlewares which are clojure-native, not sure how it goes with CLJS REPL. If you can figure out what’s going on and what’s needed to make CLJS tick, it would be a great help. See also #31

eneroth commented 2 years ago

Shadow-CLJS exposes a normal CLJ socket REPL as well as an NREPL, so I'm not connecting to CLJS. I've never bothered running a socket or NREPL separately, seeing as Shadow provides one: https://shadow-cljs.github.io/docs/UsersGuide.html#_clojure_repl

Once connected to the CLJ REPL, it's possible to tunnel into the CLJS one.

sepisoad commented 2 years ago

I'm also suffering from the same issue

alekzvik commented 2 years ago

TL;DR shadow-cljs implements nrepl protocol for v0.4. Clojure Sublimed expects at least 0.8.

I encountered the same issue. After I turned the debug: True, I noticed that shadow-cljs's nrepl replies with unknown-op

A few hours later, I found out that shadow-cljs redefines middlewares for nrepl and requires them one by one here This piece of code was introduced for nrepl version 0.4, and after comparing to the list in v1.0.0, I found four middlewares are missing. One of them is a middleware to add middlewares that Clojure Sublimed wants to use. I tried patching shadow-cljs, but no luck so far - I am stuck on this error.

I will post an update if I resolve this, but I wanted to share my findings anyway to save time for the next person trying to figure it out.

tonsky commented 2 years ago

Thanks @alekzvik! Another angle of attack might be for Clojure Sublimed to not require extra middlewares for CLJS

alekzvik commented 2 years ago

@tonsky, or they can be optional. A describe op can return a list of supported operations from the nREPL server. This approach might also be helpful in #29

tonsky commented 1 year ago

Should work in 2.8.0 via Connect shadow-cljs command