Skip to content

Auto detect multiple nrepl connection options, if they exist #3140

@zalky

Description

@zalky

Expected behavior

I often need to connect to both a clj nrepl server as well as a shadow-cljs nrepl server for full stack dev. Because the clj nrepl server prints its port to .nrepl-port, and shadow prints its port to .shadow-nrepl/nrepl.port, ideally their respective ports should both be automatically discoverable when I try to connect via cider-connect.

Actual behavior

If a clj nrepl server has already printed its port to .nrepl-port, cider-connect will fail to auto-detect the shadow nrepl server port in .shadow-nrepl/nrepl.port. With only a shadow nrepl server running, the shadow nrepl port is automatically detected.

Steps to reproduce the problem

Make sure you have both a clj nrepl server started as well as a shadow cljs nrepl server started before you try to connect to the shadow-cljs server via cider-connect.

I'm not super familiar with the code-base, but as best I can tell the conditional in nrepl-extract-port in nrepl-client.el will always return a single result and cause .nrepl-port to shadow .shadow-nrepl/nrepl.port. nrepl-extract-port might need to return a list.

Environment & Version information

CIDER version information

;; CIDER 1.1.0 (package: 1.1.0.1) (Plovdiv), nREPL 0.8.3
;; Clojure 1.10.3, Java 1.8.0_302

Emacs version

GNU Emacs 27.2 (build 1, x86_64-apple-darwin18.7.0)

Operating system

OSX 11.6.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions