From f7f40acc7916a40e477e871cc87e632471a6a3af Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Wed, 20 May 2026 15:03:43 +0300 Subject: [PATCH] Recognize let-go as a known nREPL runtime let-go (https://github.com/nooga/let-go) is a Clojure dialect implemented in Go that ships an nREPL server. Connections work today via plain `cider-connect-clj`, but `cider-runtime` reported `generic` for them, so the connection info line was bare (no runtime version). Add a `cider--let-go-version` helper that reads the `let-go` key from the `describe` response's `versions` map (let-go reports separate `major`/`minor` fields rather than a `version-string`, hence the custom format). Wire it into `cider-runtime`, the capability table in `cider--connected-handler`, and the `cider--connection-info` runtime cond. Also list let-go on the "Other Platforms" docs page. Verified end-to-end against a running let-go 2.0.2 nREPL: connection info reads `CLJ project@localhost:2137 (let-go 1.0)` and a simple `(+ 1 2)` round-trips as expected. --- CHANGELOG.md | 1 + .../ROOT/pages/platforms/other_platforms.adoc | 1 + lisp/cider-connection.el | 8 ++++++++ lisp/cider-session.el | 12 ++++++++++++ 4 files changed, 22 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48d5fc8a7..5a03e33eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Cache the result of `cider--running-nrepl-paths` (used by `cider-locate-running-nrepl-ports`) for `cider-running-nrepl-paths-cache-ttl` seconds (default 5). Repeated `cider-connect` completions no longer re-spawn a fresh round of `ps`/`lsof` subprocesses each time. `cider-clear-running-nrepl-paths-cache` discards the cache on demand. - New `nrepl-make-eval-handler` with a keyword-arg API (`:on-value`, `:on-stdout`, `:on-stderr`, `:on-done`, `:on-eval-error`, `:on-content-type`, `:on-truncated`). Sub-handlers no longer take a buffer argument -- they close over whatever they need. `nrepl-make-response-handler`, the legacy 7-positional-arg form, is preserved as an obsolete shim that adapts the old (buffer x) lambdas to the new (x) lambdas, so existing extensions keep working. - New `cider-repl-history-doctor` command: walks `cider-repl-input-history` looking for entries whose parens don't balance under Clojure syntax, shows each in a side buffer, and asks whether to delete it. When done, rewrites `cider-repl-history-file` if one is configured. Useful for cleaning up history after a typo got committed that breaks `cider-repl-history` rendering (see [#3915](https://github.com/clojure-emacs/cider/issues/3915)). +- Recognize [let-go](https://github.com/nooga/let-go) (a Clojure dialect implemented in Go) as a known nREPL runtime. `cider-runtime` returns `let-go` for these connections and the connection info line shows the runtime version, e.g. `CLJ project@localhost:2137 (let-go 1.0)`. - Decouple the nREPL transport layer from CIDER's UI layer (closes [#1099](https://github.com/clojure-emacs/cider/issues/1099)). `nrepl-make-eval-handler` is now CIDER-agnostic: it no longer references `nrepl-namespace-handler-function`, `nrepl-err-handler-function`, `nrepl-need-input-handler-function`, or any hardcoded UI strings. New `:on-ns` and `:on-status` keyword slots let any consumer wire up their own namespace tracking and status handling. The editor-level `cider-make-eval-handler` wraps it with CIDER's UI behavior (ns tracking, default error handler, need-input prompt, "Evaluation interrupted." / "Namespace not found." messages); in-tree callers all use it. ### Bugs fixed diff --git a/doc/modules/ROOT/pages/platforms/other_platforms.adoc b/doc/modules/ROOT/pages/platforms/other_platforms.adoc index fb225c392..e3510e42b 100644 --- a/doc/modules/ROOT/pages/platforms/other_platforms.adoc +++ b/doc/modules/ROOT/pages/platforms/other_platforms.adoc @@ -29,6 +29,7 @@ Here's an incomplete list of Clojure platforms that you can use as described abo * https://github.com/babashka/nbb[nbb] * https://github.com/babashka/scittle[scittle] * https://github.com/BetterThanTomorrow/joyride[joyride] +* https://github.com/nooga/let-go[let-go] (a Clojure dialect implemented in Go) NOTE: For `nbb` you can alternatively connect via `cider-connect-cljs`, see xref:platforms/nbb.adoc[nbb]. diff --git a/lisp/cider-connection.el b/lisp/cider-connection.el index d843b4a9b..1db03b235 100644 --- a/lisp/cider-connection.el +++ b/lisp/cider-connection.el @@ -254,6 +254,7 @@ See `cider-connection-capabilities'." ('babashka '(babashka jvm-compilation-errors)) ('nbb '(cljs)) ('scittle '(cljs)) + ('let-go '(let-go)) (_ '())) (when (eq cider-repl-type 'cljs) @@ -347,6 +348,13 @@ about this buffer (like variable `cider-repl-type')." (plist-get nrepl-endpoint :port) (cider--babashka-version) (cider--babashka-nrepl-version))) + ((cider--let-go-version) + (format "%s%s@%s:%s (let-go %s)" + (if genericp "" (upcase (concat (symbol-name cider-repl-type) " "))) + (or (cider--project-name nrepl-project-dir) "") + (plist-get nrepl-endpoint :host) + (plist-get nrepl-endpoint :port) + (cider--let-go-version))) (t (format "%s%s@%s:%s" (if genericp "" (upcase (concat (symbol-name cider-repl-type) " "))) diff --git a/lisp/cider-session.el b/lisp/cider-session.el index 5826e2c20..c7efb6cb9 100644 --- a/lisp/cider-session.el +++ b/lisp/cider-session.el @@ -203,6 +203,17 @@ But helps us know if this is a nbb repl, or not." (when nrepl-versions (nrepl-dict-get nrepl-versions "scittle-nrepl")))) +(defun cider--let-go-version () + "Retrieve the underlying connection's let-go version. +Formatted as \"MAJOR.MINOR\" since let-go's nREPL `describe` response +splits the version into separate fields rather than a `version-string`." + (with-current-buffer (cider-current-repl) + (when-let* ((versions nrepl-versions) + (lg (nrepl-dict-get versions "let-go"))) + (format "%s.%s" + (or (nrepl-dict-get lg "major") "?") + (or (nrepl-dict-get lg "minor") "?"))))) + (defun cider-runtime () "Return the runtime of the nREPl server." (cond @@ -210,6 +221,7 @@ But helps us know if this is a nbb repl, or not." ((cider--babashka-version) 'babashka) ((cider--nbb-nrepl-version) 'nbb) ((cider--scittle-nrepl-version) 'scittle) + ((cider--let-go-version) 'let-go) (t 'generic))) (defun cider-runtime-clojure-p ()