-
-
Notifications
You must be signed in to change notification settings - Fork 645
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
cider-repl-type is incorrect during cljs REPL startup #1557
Comments
There's no particular reason, but I don't think that is going to work. IIRC, cider sends a couple of Eval requests to a repl immediately after it connects. So even if we set the repl-type to something else it would be immediately reset to Another option is to make it so that the sibling REPL connection is lower priority than the original one. That way, as long as they're both clj, the original one will take precedence. |
"make it so that the sibling REPL connection is lower priority than the original one." This would solve one half of it: when you compile clj source buffers it'll pick the highest priority clj repl connection instead of the default connection. I think there's still an issue of what happens when you try to compile a cljs file without a known cljs connection buffer. In this case, what should officially happen when you try to compile a cljs buffer and there's no established cljs repl connection open? WRT the priority connection buffers, this feels a fairly fundamental change, but would work (if the above issue is also resolved). |
It should error out. If that doesn't happen currently then that's yet another bug. ☺ |
It doesn't error out, currently just hangs. I will dig into it more, but that's the behaviour I'm seeing. |
I think it's a bug in the logic of cider-map-connections. When you invoke commands in a cljs file and there's no ClojureScript REPL it should throw user-error. |
Both of the issues should be settled. Let me know if it seems to work. Now, if your cljs connection hasn't fully setup yet (such as when it's waiting for you to open a browser page) then doing things like |
This is about a problem of firing up two buffers using
cider-jack-in-clojurescript
, and the cljs repl buffer hascider-repl-type
set to 'clj', meaning CIDER tries to perform operations such asload-file
against the wrong connection-buffer (cljs rather than clj, leading to hanging and other issues).Background:
The
cider-repl-type
on the cljs REPL gets set when(cljs-repl)
is executed.There are reasons why someone may have a cljs repl buffer open, but the execution of
(cljs-repl)
hasn't returned/happened yet. My config uses figwheel, as per below (taken from #1427):The call to
(cljs-repl)
hangs until I open up a page in the browser which establishes the browser REPL connection.The problem is what happens in the in-between state. I use
cider-jack-in-clojurescript
which fires up two REPL buffers. During the in-between state, BOTH repls reportcider-repl-type
to be 'clj'. As it happens, usually the default-connection is the cljs one, except now it has the problem of thinking it's 'clj' rather than 'cljs'.This has the consequence that you can attempt to compile a clj buffer into the cljs connection. This is because when you execute CIDER commands such as
load-file
, the connection buffer to be used is matched against the source buffer, based on the underlyingcider-repl-type
of the connection buffer (and whether the source buffer isclojurescript-mode
vsclojure-mode
).Unless I'm doing something wrong, I think this is a bug in CIDER. To restate the problem: the developer must have established a browser REPL connection in the CLJS buffer, to avoid having problems; CLJ doesn't compile into the CLJS REPL buffer, and the vice-versa of trying to compile CLJS into CLJ.
For a solution, is there a reason why the connection-buffer spawned via
cider-create-sibling-cljs-repl
by default has thecider-repl-type
set to 'clj' rather thancljs
? Or maybepending-cljs
or evenunknown
.Other related issues: #1509, #1511, #1400
The text was updated successfully, but these errors were encountered: