Fork me on GitHub
David Pham09:06:15

Does anyone has issue with autocompletion with the newest cider, clojurescript and shadow-cljs? I get a null pointer exception.

Brandon Olivier14:06:54

I can't get the refactoring tools or company mode to work, but I haven't looked into it much.


Hi all. How to create new file/namespace from within cider?


You can create new .clj files the normal Emacs way with find-file , and if you have clj-refactor it will automatically add the ns form


see the variable cljr-add-ns-to-blank-clj-files


Thanks @UCPS050BV, I'll check this out


Works nicely. Thanks again @UCPS050BV!

Phil Jackson15:06:22

Hey. Shadow-cljs, latest cider - when I cider-connect to an nrepl port, all seems well and I get a repl in Emacs, however, all commands from a src buffer give me: user-error: No cljs REPLs in current session...

Phil Jackson15:06:55

Doing a jack-in works fine.


@phil638 Are you using shadow-cljs 2.10? There were some big changes to its internals, so it might be something related to that. There hasn’t been any recent changes on CIDER’s end with respect to shadow and cljs in general.

Phil Jackson15:06:25

Ah, I'm only on 2.8.110 - would you recommend 2.10 instead?

Phil Jackson15:06:57

From a cider point of view, I mean.


Well, it shouldn’t make much of a difference but you can always try.


The error you got seems to indicate something went wrong in the REPL init process, which might be related to something wrong in shadow. Not sure.

Phil Jackson15:06:10

Cool - I'll do some poking around. Thanks for the input.

Phil Jackson16:06:31

@bozhidar I'm finding cider--match-repl-type is seeing pending-cljs when it's looking for cljs.

Phil Jackson16:06:19

So that buffer gets filtered out in cider-repls.


the buffer should be set to cljs when it connects to a running app, either node or the browser. has this happened yet?

Phil Jackson16:06:13

I can js/alert from the cider repl itself.

Phil Jackson16:06:18

With no issues.


and what is cider-repl-type in that buffer?


the repl buffer i mean


it never got set then i guess. there's a bit of a complicated state tracker in there


In Clojure. 🙂 cider-nrepl


But it’s not complicated actually - all it checks for is the presence of a piggieback session, nothing more.


i would probably toggle nrepl message logging and then restart the repl. then watch the messages in startup and watch for the repl-type keyword


nrepl-toggle-message-logging and see if this message comes:

  id                 "10"
  session            "f042944b-6101-46a7-a80f-653115475bfb"
  time-stamp         "2020-06-05 11:23:59.380273000"
  changed-namespaces (dict ...)
  repl-type          "cljs"
  status             ("state")


that's how the pending gets upgraded to cljs


Almost every time someone experienced this problem it turned out that this cljs check wasn’t working.

Phil Jackson16:06:21

I see this in the messages, could it be relevant?:

Phil Jackson16:06:27

(<-- id "10" op "version" session "e51ed50e-32bb-4ec6-8951-d3600453a82e" time-stamp "2020-06-05 17:31:05.659201954" status ("done" "unknown-op" "error") )

Phil Jackson16:06:04

(I never see the "state" message, btw)


sounds like a bad nrepl server then. i think everyone should be able to respond to version?

Phil Jackson16:06:41

Ok, what's the helpful thing for me to do, raise a bug with all of this information?

Phil Jackson16:06:08

Like I said, jack-in works fine.


why does jack-in work in a cljs project?


how are you starting your project?

Phil Jackson16:06:51

cider-jack-in-cljs specifically.


ok. that ensures that cider-nrepl is present. how are you starting up your app?

Phil Jackson16:06:36

The thing that's not working is cider-connect-cljs to a shadow-cljs watch dev.


it sounds like you are missing the cider-nrepl middleware from your classpath


look in your *Messages* buffer for how CIDER starts up the shadow-cljs server


it will include the cider-nrepl middleware

Phil Jackson16:06:36

Yep, you nailed it. If I include cider-nrepl in my deps it works.

Phil Jackson16:06:43

Thanks for helping me debug that!

cider 4

but this should probably be a ticket/issue. CIDER should handle the lack of cider-nrepl gracefully if missing features


Good point. It seems it used to handle it just fine before the pending state was added, as I see in the state handler that it does nothing in the absence of the middleware. I assume before we added pending the state started as cljs and probably we need to do something similar.

Phil Jackson16:06:19

I'll update the docs as a starter.