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

REPL buffer name always show "clj" #2332

Closed
manuel-uberti opened this issue Jun 18, 2018 · 18 comments
Closed

REPL buffer name always show "clj" #2332

manuel-uberti opened this issue Jun 18, 2018 · 18 comments
Milestone

Comments

@manuel-uberti
Copy link
Contributor

manuel-uberti commented Jun 18, 2018

Expected behavior

After a successful cider-jack-in-cljs and the selection of the proper CLJS REPL, the REPL buffer name show indicate that this is a CLJS REPL. The same happens with the CIDER modeline indicator for the REPL buffer.

Actual behavior

The REPL buffer name and the modeline indicator only show clj, both for CLJ and CLJS REPLs.

Steps to reproduce the problem

  • create a new project with lein new
  • add [org.clojure/clojure "1.9.0"] and [org.clojure/clojurescript "1.9.946"] as dependencies.
  • create a new CLJS file
  • hit C-c M-J or M-x cider-jack-in-cljs

Environment & Version information

CIDER version information

;; CIDER 0.18.0snapshot (package: 20180617.2338), nREPL 0.2.13
;; Clojure 1.9.0, Java 1.8.0_171

System details

GNU Emacs 27.0.50 (build 1, x86_64-debian-linux-gnu, GTK+ Version 3.22.30)
 of 2018-06-18

Repository revision: 3e2215642bbca3d1335155278eace39d0a87c267
Configured using:
--host=x86_64-debian-linux-gnu

Emacs uptime: 27 minutes, 12 seconds
Colour theme: sanityinc-tomorrow-night
Operating system: Ubuntu 18.04 LTS
Window system: x11
Desktop environment: GNOME Shell 3.28.1
@vspinu
Copy link
Contributor

vspinu commented Jun 18, 2018

It's hard to say if your package is before or after #2324. Please upgrade and try again.

With the change, CLJS repl type is now changed only once the upgrade to the CLJS repl was successful. All REPLs start with clj initially.

So either you didn't wait enough for the cljs upgrade to happen or there was an issue with the upgrade. Do you see the familiar:

To quit, type: :cljs/quit
nil
cljs.user> 

?

@manuel-uberti
Copy link
Contributor Author

Yes, I see the prompt and I can interact with the browser as usual. I'll try reinstalling it again.

@manuel-uberti
Copy link
Contributor Author

It's the latest version, because I have cider-describe-current-connection bound to C-c M-d which was introduced by the commit you mentioned.

By the way, C-c M-d in the same project where I found the reported error gives me this:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  cider--connection-info(nil)
  cider-describe-current-connection()
  funcall-interactively(cider-describe-current-connection)
  call-interactively(cider-describe-current-connection nil nil)
  command-execute(cider-describe-current-connection)

But this is probably another issue. :)

@vspinu
Copy link
Contributor

vspinu commented Jun 18, 2018

It might be related. There have already been a fiew more fixes pushed in and one still pending (#2334). Hopefully those fix your issue as well.

@vspinu
Copy link
Contributor

vspinu commented Jun 18, 2018

BTW, does your modeline show CLJS? If so then it's probably some local issue. Have you overwritten nrepl-make-buffer-name, nrepl-repl-buffer-name or had some other non trivial customization relating to buffer name templating.

Both buffer names and mode-line are set in the same place and should either work or not together.

@manuel-uberti
Copy link
Contributor Author

Just upgraded. This what I see after C-c M-J:

shot

@vspinu
Copy link
Contributor

vspinu commented Jun 19, 2018

Probably the same issue as with shadow-cljs in #2305. It looks like the state handler is not recognizing figwheel as well.

To be more specific, with the recent changes type of buffer is changed only when the upgrade to cljs has finished and state handler has sent an appropriate response. Previously repl type was set right away at the jack-in.

I won't have time to check your issues with figwheel today but tomorow for sure. For now you can execute (cider-set-repl-type "cljs") to set it manually.

@bbatsov
Copy link
Member

bbatsov commented Jun 21, 2018

I've implemented a simple workaround for the shadow-cljs issues until someone gets to find the real issue in the middleware 5bc9326

@garrett-hopper
Copy link
Contributor

Regarding the error @manuel-uberti was seeing:

Debugger entered--Lisp error: (wrong-type-argument stringp nil)
  cider--connection-info(nil)
  cider-describe-current-connection()
  funcall-interactively(cider-describe-current-connection)
  call-interactively(cider-describe-current-connection nil nil)
  command-execute(cider-describe-current-connection)

When both a clj and a cljs repl exist, the error seems to be turned on and off depending on which repl was the last to be active. If I switch to the cljs buffer then to a clj file, C-c M-d give the error, but if I then switch to the clj repl and back, it doesn't.

Should I create a new issue for this?

@bbatsov
Copy link
Member

bbatsov commented Jun 24, 2018 via email

@bbatsov bbatsov added this to the v0.18 milestone Jun 25, 2018
@vspinu
Copy link
Contributor

vspinu commented Jun 27, 2018

@manuel-uberti, if you are running figweel then steps to reproduce should be different. One needs the side car at the least. With lein new figwheel hello-world -- --reagent I don't see the problem. The jack-in results in cljs repl as expected.

I still believe the most plausible explanation is that something goes wrong with the state message. Do you see see following message in the nrepl-messages buffer?

(<--
  id                 "12"
  session            "d5d663a5-af8a-46d5-b182-549565bba7fe"
  time-stamp         "2018-06-27 17:54:12.339331997"
  changed-namespaces (dict ...)
  repl-type          "cljs"
  status             ("state")
)

You could also edebug cider-set-repl-type and check if it enters the last part where buffer name and mode-name are set. It should enter twice, first on repl initialization when it is set to clj and second time when called by the status nrepl handler.

@manuel-uberti
Copy link
Contributor Author

Yes sorry, Figwheel must be setup in project.clj as well of course.

@manuel-uberti
Copy link
Contributor Author

Any news on this?

@dpsutton
Copy link
Contributor

@manuel-uberti are you using cider/piggieback or cemerick/piggieback?

I have a PR on cider-nrepl to switch some logic. When checking to see if its a cljs repl, cider-nrepl looks to see which piggieback you are using and then looks for the compiler environment there. But we automatically inject cider/piggieback now so that will always resolve as true. The result is that we no longer correctly look for cemerick/piggieback

clojure-emacs/cider-nrepl#535

@manuel-uberti
Copy link
Contributor Author

manuel-uberti commented Jul 10, 2018

@dpsutton [cider/piggieback "0.3.6"].

@bbatsov
Copy link
Member

bbatsov commented Jul 10, 2018

In the mean time @thheller also fixed this in shadow-cljs, so now we're airtight there. :-)

@manuel-uberti
Copy link
Contributor Author

manuel-uberti commented Jul 12, 2018

I upgraded cider to latest from MELPA. Working on a CLJ/CLJS project today. Now the 2 REPLs correctly show clj and cljs.

@bbatsov
Copy link
Member

bbatsov commented Jul 12, 2018

Thanks to @dpsutton and @thheller for this!

@bbatsov bbatsov closed this as completed Jul 12, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants