cider

Harold 2024-10-15T22:07:27.875169Z

I am using cider-connect, and .nrepl-port file exists with the right port number in it, but after choosing localhost I am still prompted to enter 0 Port for localhost: in the minibuffer. Any ideas what might be going wrong? Maybe CIDER is looking in the wrong directory for the .nrepl-port file?

Harold 2024-10-15T22:08:58.828799Z

entering the port manually connects perfectly More info:

;; Connected to nREPL server - 
;; CIDER 1.15.0 (Cogne), nREPL 1.0.0
;; Clojure 1.12.0, Java 11.0.24
;;     Docs: (doc function-name)
;;           (find-doc part-of-name)
;;   Source: (source function-name)
;;  Javadoc: (javadoc java-object-or-class)
;;     Exit: <C-c C-q>
;;  Results: Stored in vars *1, *2, *3, an exception in *e;

Harold 2024-10-15T22:09:18.618629Z

I guess I just want to skip the manual step of entering the port number. Thank you!

Harold 2024-10-15T22:09:20.572549Z

🙂

iarenaza 2024-10-15T22:50:46.015449Z

I think it always asks for the port, ignoring that file. Because you could be connecting to any machine, not just the local one. In which case the file wouldn't be available locally. And even if you connect to 127.0.0.1, it might not be there. Because you could be connecting to a REPL process that is running inside a Docker container (we do this at work). The file would exist inside the container, but not necessarily in the host.

👍 1
iarenaza 2024-10-15T23:05:47.368199Z

Also, if you are launching your REPL process on a fixed port (like we do), you can use cider-known-endpoints configuration setting to keep a list of "known endpoints to cider-connect-clj to". CIDER will helpfully show those when you execute cider-connect-clj.

👍 1
Harold 2024-10-16T00:35:11.824139Z

Ah! You're right, I probably just had some bad assumption coming from previous use of cider-jack-in --- I like the idea of a fixed port and cider-known-endpoints , that's helpful. Thank you.

Harold 2024-10-16T00:36:12.657729Z

Having it pick up the wrong port automatically and fail to connect would be way worse than just prompting, so that makes sense.