Fork me on GitHub
#cider
<
2020-06-05
>
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.

gigal00p11:06:29

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

yuhan11:06:23

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

yuhan11:06:44

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

gigal00p11:06:41

Thanks @UCPS050BV, I'll check this out

gigal00p11:06:06

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.

bozhidar15:06:40

@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.

bozhidar15:06:56

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

bozhidar15:06:48

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.

dpsutton16:06:40

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.

dpsutton16:06:22

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

dpsutton16:06:28

the repl buffer i mean

dpsutton16:06:10

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

bozhidar16:06:50

In Clojure. 🙂 cider-nrepl

bozhidar16:06:11

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

dpsutton16:06:26

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

dpsutton16:06:18

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")
)

dpsutton16:06:24

that's how the pending gets upgraded to cljs

bozhidar16:06:11

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)

dpsutton16:06:35

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.

dpsutton16:06:03

why does jack-in work in a cljs project?

dpsutton16:06:11

how are you starting your project?

Phil Jackson16:06:51

cider-jack-in-cljs specifically.

dpsutton16:06:24

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.

dpsutton16:06:24

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

dpsutton16:06:40

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

dpsutton16:06:49

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 1
dpsutton16:06:49

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

bozhidar20:06:43

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.