-
-
Notifications
You must be signed in to change notification settings - Fork 649
When jacking in to shadow, the cider-repl-type is prematurely being reported as cljs
while it is not (yet)
#3287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
cljs
while it is not (yet)
I see thanks for the in depth analysis. Yea indeed the repl type currently also signals "pending" or not. So we should preserve saying "pending" for pending-cljs.
Here is one fix for this. I'll try to double check with running the tests. |
Turns out what I posted does not fix it, because during initialization the pending repl also becomes a clj repl. I think the best way would be to split the idea of "pending-cljs" into a speparate identity. |
#3291 turned out to be relatively straight forward |
This pull request addresses #3287 by separating the concept of a repl type from the concept of pending cljs upgrade status. The pending variable is now set when the repl is initialized, and it is set to nil when we are sure that we have a cljs repl in cider-repl--state-handler.
Uh oh!
There was an error while loading. Please reload this page.
Hi,
It appears that the latest logic in #3282 is prematurely reporting that a shadow nREPL session, created with
cider-jack-in-cljs
, has switched tocljs
while it is stillclj
, which is wrong.E.g. calling
(cider-repls 'cljs nil)
just a little while after acider-jack-in-cljs
for a node repl, returns a cljs cider REPL even though the shadow repl has not yet received the commands from the client to switch to cljs.This misbehavior is caught by the cljs
jack in
to-shadow
integration test.The test does the following to test that jacking in to a shadow cljs REPL works (high level description):
(cider-repls 'cljs nil)
until it returns a cider cljs repl.(print :cljs? (some? *clojurescript-version*))
The expectation here is that the cljs REPL will print out the clojurescript version, but the REPL returns the following error (requires the improved integration anlalytics #3285 to see it)
This is because the REPL evaluated the code in Clojure but not in ClojureScript as expected. The issue is with step 3 above that is misreported that there is a cider cljs repl available, while there is none (yet) available.
This used to work as expected before #3282. Looking at the code, I've traced the error to be caused by the new connection capabilities as follows (high level description):
cider-repl-type
on the client buffer is set topending-cljs
.cider-repl-type
is set topending-cljs
, the connection capability is set tocljs
:cider--match-repl-type
was before only checking the bufferscider-repl-type
local varabile to confirm whether the type iscljs
, but now it also looks at the connection capabilities above:cider-repl-type
will start its life aspending-cljs
, and in the case of shadow node repl connection will eventually move toclj
and thencljs
by the repl server.cider--match-repl-type
would only return true afterrepl-type
was reported by the server to becljs
. The shadow nREPL server will first report itsrepl-type
asclj
and after a while, after the ClojureScript code is compiled and brought up by shadow, it will then reportcljs
. Thus it will take a while beforecider--match-repl-type
returns true, and only if the clojurescript code has been succesfully compiled.cider--match-repl-type
will also look at the connection capabilities, the capabilities are immediately set tocljs
(even though the cider-repl type is stillpending-cljs
), and the function will return true even though the REPL has not yet switched to cljs. This has a chain effect for(cider-repls 'cljs nil)
to return the REPL even though it is notcljs
, which is wrong.To cocnclude it appears to me the new capabilities logic have broken the shadow cljs jack in functionality by immediately reporting the shadow REPL as being cljs while it is not. I think the logic has to be revisited.
Thanks,
cc @benjamin-asdf
The text was updated successfully, but these errors were encountered: