I'm trying to connect to scittle with CIDER following the exact instructions in https://github.com/babashka/scittle/tree/main/doc/nrepl, and am getting an exception:
Fri Dec 22 10:49:58 CET 2023 [worker-1] ERROR - handle websocket frame org.httpkit.server.Frame$TextFrame@53da070f
java.lang.RuntimeException: No reader function for tag object
Does anyone have any idea what might be going wrong here? I added the elisp snippet as directed.Just a follow-up on this: somehow the REPL works connected to my buffer! I have no clue what combination of eldritch ceremonies accomplished this, but I'm happily Scittling along and will be posting a blog thingy in the next couple of days about my misadventures. 😉
don't know, what CIDER version are you using? at one point it worked for sure :)
hmm, httpkit?
ah yes, httpkit is used here: https://github.com/babashka/sci.nrepl/blob/main/src/sci/nrepl/browser_server.clj
does this happen with any evaluation or only with some?
let me try
yeah I can reproduce this, damnit.
at clojure.edn$read_string.invokeStatic(edn.clj:46)
at clojure.edn$read_string.invokeStatic(edn.clj:37)
at clojure.edn$read_string.invoke(edn.clj:37)looking into a fix
I'm using the newest sci.nrepl commit now and can't repro this but nothing happens either
this is either CIDER bitrot or scittle nrepl bitrot... aaaaargh
ah ok got it working
cider-connect-cljs and then select nbb
I see, the scittle/doc/nrepl stuff was already at the latest commit, but locally I wasn't on the latest commit
there is some edn read issue, going to check what the hell this is now
It seems this commit at least broke something: https://github.com/babashka/sci.nrepl/commit/2f8a9ed2d39a1b09d2b4d34d95494b56468f4a23 cc @benjamin.schwerdtner And something else changed in CIDER I think because in the REPL window I can evaluate, but not from the buffer.
I reverted the handling of unknown nREPL ops to send
(send-response (assoc ctx :response {"status" #{"error" "unknown-op" "done"}}))
This seems to at least fix the EDN serialization errorPerhaps you can try that one @jmglov? https://github.com/babashka/sci.nrepl/commit/2c3c18ebda189ae54fb2b3294b1f5ca609ed1b96
about the in-buffer evaluation: don't know yet
I don't know what changed in CIDER but this is pretty frustrating
I might have a look at this later but right now I'm not in the mood to force-quit my emacs every time I try something...
In Calva / VSCode it does work: 🤷
Yeah, everything just works without any changes in Calva / VScode
So something in CIDER probably changed, don't know what.
please use scittle 0.6.15 https://github.com/babashka/scittle/releases/tag/v0.6.15 Also, when you did jack in clj, it didn't count as cljs currently, fix: https://github.com/clojure-emacs/cider/pull/3600 I suspect if you say connect cljs -> nbb its a workaround for the second issue right now. Cider hanging is probably because the scittle version is old. The current sci.nrepl implementation asks the scittle server for "describe". It was sort of a breaking change we thought would be tolerable, but yea
example sci.nrepl deps:
:deps
{sci.nrepl/sci.nrepl
{:git/sha "2f8a9ed2d39a1b09d2b4d34d95494b56468f4a23"
:git/url ""}} @benjamin.schwerdtner I used bb dev in this directory which uses 0.6.15: https://github.com/babashka/scittle/blob/main/doc/nrepl/index.html
same deps are you
@benjamin.schwerdtner thanks for looking into this ❤️ does it work for you at all right now?
can cider-connect-clj works for me
ok let me try again
using the cider patch I made
ok, but when choosing nbb this shouldn't matter without your patch, correct?
else cider-connect-cljs -> nbb works as a workaround
yes
ok, I'm going to try now
if cider hangs ctrl-g lol
I'm running:
borkdude@m1 ~/dev/scittle/doc/nrepl (main) $ bb dev
Serving static assets at
Websocket server started on 1340...
nREPL server started on port 1339...
I'm going to open the web page and then do the connect sequence in emacsI am getting:
Fri Dec 22 13:47:16 CET 2023 [] ERROR - handle websocket frame org.httpkit.server.Frame$TextFrame@53d31621
java.lang.RuntimeException: No reader function for tag object
at clojure.lang.EdnReader$TaggedReader.readTagged(EdnReader.java:801)
in the server (like in the OP)
and emacs hangs. I didn't get any choices after doing cider-connect-clj (this is why I did cider-connect-cljs before)ctrl-g doesn't work, only force quit (😡 )
I am surprised
hahaha, after force quit, I get a popup from emacs if I want to save a file. when I then say no, then it works
except in-buffer eval
fucking hell, this is brittle stuff
hm that sounds like multiple issues
let me upgrade cider so I'm at least on the same version as you
yes, the EDN read issue is caused by the SCI context being part of the EDN response, which should be left out. I'm surprised this doesn't cause an issue with VSCode. It seems to happen when the version is requested by CIDER, an op which isn't implemented
I'm going to upgrade to cider 20231204.843 available melpa Clojure Interactive Development Environment that Rocks
Ah. so we try to edn print some function hence the error
yeah
I am on 25c51fd4b1246801ba3fa15c57b44d860772417c cider master
I don't know why the heck we assoc the context here and in several other places: https://github.com/babashka/scittle/blob/9791c281e32bc11029ac6c99418045fba355596f/src/scittle/nrepl.cljs#L65
but even when I dissoc-ed it here https://github.com/babashka/scittle/blob/main/src/scittle/nrepl.cljs#L14-L17 it didn't completely work
upgrading CIDER didn't help
@benjamin.schwerdtner I think the context accidentally becomes part of the response on an unknown/unsupported nREPL op: https://github.com/babashka/scittle/commit/95740162d42bf4c9a2a17740c4eed07b0899229d
yes. I can reproduce by sending a random request
nrepl.cljs line 71 should not add the ctx to the response I suppose
indeed
I can push that change and test if it helps locally
I forgot how to dev scittle. Want a repl to see what ctx does and where session and id should come from
here is how you can do it. in the root of the project, run bb dev
and then visit localhost:.../nrepl.html
and then I open the doc/nrepl/playground.cljs file to evaluate something
cider-connect-clj is still completely stuck for me
but no edn read errors, so I'm going to push that change
pushed to main
I guess why vscode/calva works and emacs doesn't (before at least) is that nrepl should actually never try an op that isn't present in describe
it seems CIDER is asking for op version
emacs still completely stuck for me
no errors in the server however
(nrepl-reply msg (merge msg {:status ["error" "done"] :err "unkown-op"}))
this seems correct and seems to workwith this I can send a random req and get an error without issue
is that any different than what I pushed?
no its the same
wait
I swapped the message to be the first arg
this fixes cider making emacs stuck and the parse edn error afaik. So there is some remaining issue where cider asks for version but shouldn't? I think on my end it does 'describe' and it turns out good.
pushed the swapped args
I'll test again
that fixes the freezing, I'm getting this though:
perhaps it's refactor-nrepl or so
cider-connect-cljs works only in REPL, not from buffer
wondering what commit this is in cider that you use. Is that v1.12.0 tag?
:msg "{:prefix-rewriting \"false\", :ns \"nrepl-playground\", :err \"unkown-op\", :debug \"false\", :op :version, :insert-newline-after-require \"true\", :status [\"error\" \"done\"], :id \"5\", :session \"df085b44-b02d-4773-9d4f-3da662f225dd\"}"I have no fucking clue, I'm just using the new cider.el from melpa
1.13.0-SNAPSHOT it says with cider-version
hm me too
don't know what prefix-rewriting is
me neither
ah the issue is it asks for op "version" and doesn't handle that it comes back with an error maybe
yes
it seems I have some old refactor-nrepl crap going on here
maybe I should just uninstall that package?
but nonetheless, the cider should just work since people might have installed it
somewhere somebody asks for "version" and that is not right, they get an error back. its not on the default latest cider by default. But its annoying that cider doesn't truck along after an error
I de-installed clj-refactor and this error went away
but it ends up in namespace nil now and I still can't evaluate from the buffer, at least not with cider-connect-clj
oh it does work when I switch to clojure-mode facepalm
the connection doesn't count as cljs so I expect that. that is the fix I pushed
instead of clojurescript-mode
hm
but I don't even get the list of choices with connect-clj, I get the list of choices with connect-cljs
@jmglov do you have clj-refactor installed in emacs? you could try without it and maybe that fixes it for you
connect-clj is 1 dimensional. connect-cljs has a second dimension of cljs-type
ok, I'm fine with that, but you mentioned connect-clj before, this is why I tried it
With my fix connect-clj should say this is scittle hence a cljs repl.
Yea.. connect-clj is great whe it is not broken
ok
with this yes: https://github.com/clojure-emacs/cider/pull/3600
well, it's somewhat less broken for me now after de-installing clj-refactor but not optimal. Calva works though
if you say connect cljs and nbb, it should also work. Unless my mental model is wrong.
it should work, but I still can't eval from a buffer
ah yes, now it works
👍
😄
and even auto-complete is working 😎
the clj-refactor package still interferes somehow, might be something to check up on
that auto complete inside scittle is such a win
Holy moly what did I start in here? 😅
I resorted to just using my cider-repl buffer, which worked after a few whacks on C-g. Couldn’t eval stuff from my code buffers, but I was at least able to REPL my browser.
I’m heading out on holiday now, but I’ll try some of the stuff in this thread if I get a chance.
Have fun during your holidays!
Using the nbb CLJS REPL type does work for me, but CIDER still doesn't understand that my buffer is connected to that REPL, so I still have to resort to typing stuff into the REPL buffer directly. This is using CIDER 1.12.0 and uninstalling clj-refactor.
@jmglov does it help if you switch to clojure-mode or clojurescript-mode?
I remember I sometimes I had to switch to clojure-mode to make it work
depends on the output of cider-repls. I suppose that also has to do with the current mode. Hm; I thought cljs -> nbb should be a workaround 'till the scittle == cljs fix. @vemv https://github.com/clojure-emacs/cider/pull/3600 this is the context for the pull request. I'm not getting to cleaning it up currently
No hurry from our side