Fork me on GitHub
#cider
<
2022-08-30
>
pmooser15:08:08

For a long time, I've relied on the fact that when I do M-x cider-connect it reads the nrepl port out of .nrepl-port - when I updated recently, I notice that it is also reading the port from .shadow-cljs/nrepl.port ... so whereas before it could usefully autocomplete, now I have to go read the port files myself to see which is which. Is there a way to disable it? I assume the related code is:

(defun nrepl-extract-ports (dir)
  "Read ports from applicable repl-port files in directory DIR."
  (delq nil
        (list (nrepl--port-from-file (expand-file-name "repl-port" dir))
              (nrepl--port-from-file (expand-file-name ".nrepl-port" dir))
              (nrepl--port-from-file (expand-file-name "target/repl-port" dir))
              (nrepl--port-from-file (expand-file-name ".shadow-cljs/nrepl.port" dir)))))

bozhidar06:08:31

Yep. Other than reverting this change locally there's nothing else you can do.

bozhidar06:08:30

The change was made so that CIDER would consider every possible nREPL that's running for a particular project, which is the better behavior IMO.

pmooser13:08:15

@U051BLM8F I think it would make more sense if metadata about where the port came from was maintained, because a list of a large integers isn't really useful as an enduser if I can't distinguish which one belongs to which sort of process. Or maybe some kind of preference mechanism could exist?

bozhidar14:08:48

I'm always open to ideas for improvements, so feel free to file a ticket about this. I agree that pairing the port number with the file it came from makes sense.

pmooser14:08:34

Ok, thank you - I will see if I can file a ticket!

pmooser10:09:01

Ok, ticket filed.

Sam Ritchie15:08:25

hey all… I am running into

error in process filter: user-error: ClojureScript is not available.  See  for details
error in process filter: ClojureScript is not available.  See  for details
on a project that has worked for years. obviously emacs must have upgraded something on me; and yes I have gone to that link!

Sam Ritchie15:08:56

it’s totally unclear to me what is going wrong locally, and unfortunately nothing on the page, paired with that generic message, is illuminating.

Sam Ritchie15:08:53

sending full error message…

Sam Ritchie15:08:17

[nREPL] Starting server via /opt/homebrew/bin/clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.9.0"} cider/cider-nrepl {:mvn/version "0.28.4"} cider/piggieback {:mvn/version "0.5.2"}} :aliases {:cider/nrepl {:main-opts ["-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware,cider.piggieback/wrap-cljs-repl]"]}}}' -M:test:dev/repl:cider/nrepl
[nREPL] server started on 52185
[nREPL] Establishing direct connection to localhost:52185 ...
[nREPL] Direct connection to localhost:52185 established
error in process filter: user-error: ClojureScript is not available.  See  for details
error in process filter: ClojureScript is not available.  See  for details

Sam Ritchie15:08:23

after running cider-jack-in-cljs and selecting node

Sam Ritchie15:08:34

node is present

dpsutton15:08:09

is this a shadow project or figwheel or bare cljs?

Sam Ritchie15:08:23

bare cljs, but shadow fails as well

Sam Ritchie15:08:33

shadow starts but then that same error comes up

Sam Ritchie15:08:46

npx shadow-cljs node-repl
works fine at the command line

dpsutton15:08:50

ignore shadow for a second then. do you have clojurescript on your classpath?

Sam Ritchie15:08:09

do you mean clj, clojure?

Sam Ritchie15:08:14

is there a cljs binary?

dpsutton15:08:19

no i mean clojurescript on your classpath

Sam Ritchie15:08:28

I didn’t even know that that was a thing!

Sam Ritchie15:08:23

no mention of a standalone cljs command anywhere here and I’ve never done that. that would be an obvious issue then since I don’t have it 🙂

dpsutton15:08:41

this puts clojurescript on your classpath

dpsutton15:08:01

i am not talking about a standalone cljs command. I’m talking about the clojurescript jar present on your classpath

Sam Ritchie15:08:46

can you give me a way to see what the classpath is, in the context of the command that cider-jack-in-cljs is running?

Sam Ritchie15:08:00

sorry, missed your image

Sam Ritchie15:08:39

okay that’s closer. I have (cider-clojure-cli-aliases . ":test:dev/repl") in dir locals;

Sam Ritchie15:08:49

but the cljs dep is under a different alias

Sam Ritchie15:08:04

sounds like I need to get the cljs alias in there too

dpsutton15:08:07

then the error message that it cannot find clojurescript seems very apt

dpsutton15:08:20

yeah. you are asking it to start up a clojurescript repl but it cannot possibly do so

Sam Ritchie15:08:51

yes, but think of the debug steps: • that image is saying to put the clojurescript dep at the top level of deps.edn, which is poor form for any library; • realistically it’s always in an alias, which you can tune with an emacs variable documented somewhere else • that alias is set in a .dir-locals.el file, and named cider-clojure-cli-aliases, which you might imagine is separate from some cljs variable • that all requires some knowledge of how deps.edn aliases are layered, which is fine;

Sam Ritchie15:08:07

“:yeah. you are asking it to start up a clojurescript repl but it cannot possibly do so” this was clear from the behavior 🙂

Sam Ritchie15:08:25

I appreciate the help, just pushing back on the hint, maybe misperceived, that the deduction chain here was super obvious

dpsutton15:08:26

That image is from the document you linked me. I pointed to the step I was talking about

Sam Ritchie15:08:56

a better error might say “the clojurescript jar is missing from the classpath. you’re currently using deps.edn with the following aliases configured: <blah blah>. make sure that an entry like [clojurescript “blah”] is present in the :deps` value for one of those aliases.”

dpsutton15:08:24

That’s an excellent suggestion. If you made an issue I suspect there would be some interest

Sam Ritchie15:08:27

> “then the error message that it cannot find clojurescript seems very apt” it was apt! just not as helpful as you were!

dpsutton15:08:46

Sorry. I’ve seen this error pop up when things will actually work out. So part of my diagnosis is finding out if this is correctly erroring and it cannot work, or if it is erroring but it would have worked if we weren’t trying to be clever

Sam Ritchie15:08:17

sure, that makes sense. definitely not an easy problem, with so many editors, build setups etc

richiardiandrea16:08:28

Hi there, I started to use cider-clojure-cli-aliases and the repl starts fine in the terminal but in Emacs I see:

[nREPL] server started on 35395
[nREPL] Establishing direct connection to localhost:35395 ...
[nREPL] Direct connection to localhost:35395 established
error in process filter: cider--gather-connect-params: This is not a REPL or SERVER buffer; is there an active REPL?
error in process filter: This is not a REPL or SERVER buffer; is there an active REPL?
Does anybody know what is going on?

richiardiandrea16:08:18

Never mind, I restarted Emacs and I don't see the error anymore