-
-
Notifications
You must be signed in to change notification settings - Fork 652
Description
Expected behavior
For a running nrepl on localhost, I expected (cider-select-endpoint)
to allow me to select ports on which nrepl is running.
(I use this to connect ob-clojure buffers to cider when doing literate programming and a bit of completion comes handy)
Fixes #3390
Actual behavior
It requires me to input the port manually.
Steps to reproduce the problem
- cider-jack-in without a project
- cider-connect from another clj buffer
- follow instructions to get to the cider session you opened before
- see that there are no available ports
or more specifically:
- eval in emacs
(cider--running-nrepl-paths)
- see an empty output sigh!
My solution
Just for curiosity, I redefined cider--running-nrepl-paths
(which seems to be the culprit) as follows:
(defun cider--running-nrepl-paths ()
"Retrieve project paths of running nREPL servers.
Use `cider-ps-running-nrepls-command' and
`cider-ps-running-nrepl-path-regexp-list'."
(seq-uniq
(seq-map
(lambda (b)
(with-current-buffer b default-directory))
(seq-filter
(lambda (b) (string-prefix-p "*cider-repl" (buffer-name b)))
(buffer-list)))))
That way things seem to work fine (for localhost).
I opened an issue because I think cider-ps-running-nrepls-command
and cider-ps-running-nrepl-path-regexp-list
are somewhat outdated. I replaced the behavior going via Emacs active buffers.
Any chance you can clarify why cider is looking for active nrepl via a terminal command (greping for leiningen -- I didn't find anything using that command manually)?
If this solution seems useful, I could look into opening a PR :)
CIDER version information
1.8.0-snapshot
Lein / Clojure CLI version
lein 2.9.1 / 1.10.3
Emacs version
28.1
Operating system
Ubuntu 22.04