Clojure-Sublimed icon indicating copy to clipboard operation
Clojure-Sublimed copied to clipboard

Getting stuck on "adding middlewares"

Open eneroth opened this issue 4 years ago • 8 comments

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

eneroth avatar Dec 14 '21 09:12 eneroth

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.

jaihindhreddy avatar Dec 14 '21 10:12 jaihindhreddy

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.

eneroth avatar Dec 14 '21 10:12 eneroth

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

tonsky avatar Dec 14 '21 13:12 tonsky

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.

eneroth avatar Dec 14 '21 19:12 eneroth

I'm also suffering from the same issue

sepisoad avatar Jan 14 '22 19:01 sepisoad

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.

alekzvik avatar Aug 25 '22 01:08 alekzvik

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

tonsky avatar Aug 25 '22 12:08 tonsky

@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

alekzvik avatar Aug 25 '22 12:08 alekzvik

Should work in 2.8.0 via Connect shadow-cljs command

tonsky avatar Oct 17 '22 17:10 tonsky