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?
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; I guess I just want to skip the manual step of entering the port number. Thank you!
🙂
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.
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.
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.
Having it pick up the wrong port automatically and fail to connect would be way worse than just prompting, so that makes sense.