Skip to content
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

cljs-pending never changes to cljs despite REPL working OK. source buffers never recognise the pending REPL though #3246

Closed
PiotrWasik opened this issue Sep 17, 2022 · 12 comments
Assignees

Comments

@PiotrWasik
Copy link

PiotrWasik commented Sep 17, 2022

Expected behavior

when cljs REPL starts, it changes from pending-cljs in REPL buffer status line to cljs, and clojurescript source buffers get associated with this REPL.

Actual behavior

cljs stays in pending-cljs state and source buffers show cider[not connected]. C-z (go to repl), M-. (go to source), evaluating in source does not work. It says there is no REPL.

Steps to reproduce the problem

Minimal setup:
deps.edn
{}

shadow-cljs.edn
{:source-paths ["src"]}

src/cljs.cljs

(ns cljs)
(+ 1 7)

Then open src/cljs.cljs and cider-jack-in-cljs. I will get the REPL, browser tab is started, and I can evaluate things in REPL, but with the issue described at the top (pending-cljs, source buffers don't see the REPL).

I end up in the same situation when using cider-connect-cljs instead of cider-jack-in-cljs, or when I use figwheel-main instead of shadow-cljs.

Workaround:
I changed line 318 in cider-connection.el, in function
cider--connected-handler

(if (eq 'pending-cljs cider-repl-type)
	(cider-set-repl-type 'cljs)
      (cider-set-repl-type cider-repl-type))

CIDER version information

CIDER 1.5.0 (Strasbourg), nREPL 1.0.0
Clojure 1.11.1, Java 18.0.1

Emacs version

Emacs 28.1

Operating system

Ubuntu 22.04.1 LTS

@bennyandresen
Copy link

I can confirm this behavior. When I make sure to link the right REPL with the right buffer and I evaluate (cider-set-repl-type 'cljs) inside the pending-cljs-repl, then I can evaluate fine.

@bbatsov
Copy link
Member

bbatsov commented Sep 21, 2022

Hmm, that's weird. This is set automatically by cider-nrepl's track-state middleware and the relevant code hasn't been changed in ages. Please, check the nREPL message log for some the exact exchange that happens on the REPL upgrade. I think you'll also find 5+ similar issues on the issue tracker with more debug instructions in them.

@PiotrWasik
Copy link
Author

where is the nREPL message log please?

@bbatsov
Copy link
Member

bbatsov commented Sep 21, 2022

@bbatsov
Copy link
Member

bbatsov commented Sep 21, 2022

And that's one of the related issues I mentioned earlier #2456

@bennyandresen
Copy link

I can confirm this behavior. When I make sure to link the right REPL with the right buffer and I evaluate (cider-set-repl-type 'cljs) inside the pending-cljs-repl, then I can evaluate fine.
I tried the minimal reproducible setup above and there I wasn't able to reproduce it. It automatically moved from pending-cljs to cljs and I could eval code without any manual steps.

I have to investigate this at work in a different environment where I had that issue.

@PiotrWasik
Copy link
Author

sorry for the delay, I attached the nrepl-messages buffer content now. does it say anything useful?
nrepl-messages-when-staying-in-pending-state.txt

@lotuc
Copy link

lotuc commented Nov 24, 2022

I was facing the same problem using a shadow-cljs template setup from the Kit project.

But when I add the cider-nrepl dependency (and shadow-cljs will automatically use the middleware), every thing turns ok.

@PiotrWasik
Copy link
Author

@lotuc - I have always had [cider/cider-nrepl "0.28.7"] in dependencies, in shadow-cljs.edn. It did not help

@vemv vemv pinned this issue Jul 27, 2023
@vemv vemv self-assigned this Jul 27, 2023
@vemv
Copy link
Member

vemv commented Aug 4, 2023

This got fixed with either of these:

#3376
#3378
#3389

...I verified so by both:

  • evaling cider-repl-cljs-upgrade-pending within the repl after a successful conn
  • placing a temporary (message ,,,) right before the (setq cider-repl-cljs-upgrade-pending nil) call.

These fixes are available in CIDER master, and in the 1.8.0 release we are working towards.

Cheers - V

@vemv vemv closed this as completed Aug 4, 2023
@vemv vemv unpinned this issue Aug 4, 2023
@PiotrWasik
Copy link
Author

yes, it is working now, thanks :)

@vemv
Copy link
Member

vemv commented Aug 28, 2023

Happy to read that! 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants