[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/cider cade685f1b: Fix cljs type not set correctly (#3282)
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/cider cade685f1b: Fix cljs type not set correctly (#3282) |
Date: |
Thu, 8 Dec 2022 12:58:28 -0500 (EST) |
branch: elpa/cider
commit cade685f1b7e0429dfa27bf63fcb38cda726eae2
Author: Benjamin <38900087+benjamin-asdf@users.noreply.github.com>
Commit: GitHub <noreply@github.com>
Fix cljs type not set correctly (#3282)
* Fix cljs type not set correctly
I introduced a bug with 24b9891e0b4603dca7519427d02ff4af2cfac57a
that made cljs repls not upgrade automatically anymore to cljs (repl-type).
What actually happened was that after the init function, it was set an
ultimate time, because of the "demunge" eval call I added.
1. Move the connection capability block in fron of
=cider-nrepl-init-function=, this would by itself already fix it
because then we would eval as clj repl and in the end once as cljs
repl (which sets the repl-type see cider-repl--state-handler)
2. do not make the "demunge" eval call at all, when we already know
the repl is going to be cljs (cljs or pending-cljs).
(This would by itself also be a fix).
* Fix cljs type not set correctly
I introduced a bug with 24b9891e0b4603dca7519427d02ff4af2cfac57a
that made cljs repls not upgrade automatically anymore to cljs (repl-type).
What actually happened was that after the init function, it was set an
ultimate time, because of the "demunge" eval call I added.
1. Move the connection capability block in fron of
=cider-nrepl-init-function=, this would by itself already fix it
because then we would eval as clj repl and in the end once as cljs
repl (which sets the repl-type see cider-repl--state-handler)
2. do not make the "demunge" eval call at all, when we already know
the repl is going to be cljs (cljs or pending-cljs).
(This would by itself also be a fix).
* Fix format
---
cider-connection.el | 35 ++++++++++++++++++++++-------------
1 file changed, 22 insertions(+), 13 deletions(-)
diff --git a/cider-connection.el b/cider-connection.el
index a54cb2bbf4..fcb9dc495d 100644
--- a/cider-connection.el
+++ b/cider-connection.el
@@ -303,6 +303,26 @@ See command `cider-mode'."
(unless (cider-sessions)
(cider-disable-on-existing-clojure-buffers)))
+(defun cider--set-connection-capabilities (&optional conn-buffer)
+ "Set `cider-connection-capabilities' for CONN-BUFFER during repl init.
+See `cider-connection-capabilities'."
+ (with-current-buffer (or conn-buf (current-buffer))
+ (setf cider-connection-capabilities
+ (append
+ (pcase (cider-runtime)
+ ('clojure '(clojure jvm-compilation-errors))
+ ('babashka '(babashka jvm-compilation-errors))
+ (_ '()))
+ (when
+ (or
+ (member cider-repl-type '(cljs pending-cljs))
+ ;; This check is currently basically for nbb.
+ ;; See `cider-sync-tooling-eval', but it is defined on a
higher layer
+ (nrepl-dict-get
+ (nrepl-sync-request:eval "cljs.core/demunge" (current-buffer)
(cider-current-ns) 'tooling)
+ "value"))
+ '(cljs))))))
+
(declare-function cider--debug-init-connection "cider-debug")
(declare-function cider-repl-init "cider-repl")
(declare-function cider-nrepl-op-supported-p "cider-client")
@@ -339,25 +359,14 @@ buffer."
;; first.
(cider--debug-init-connection))
+ (cider--set-connection-capabilities)
+
(when cider-repl-init-function
(funcall cider-repl-init-function))
(when cider-auto-mode
(cider-enable-on-existing-clojure-buffers))
- (setf cider-connection-capabilities
- (append
- (pcase (cider-runtime)
- ('clojure '(clojure jvm-compilation-errors))
- ('babashka '(babashka jvm-compilation-errors))
- (_ '()))
- (when
- ;; see `cider-sync-tooling-eval', but it is defined on a
higher layer
- (nrepl-dict-get
- (nrepl-sync-request:eval "cljs.core/demunge"
(current-buffer) nil 'tooling)
- "value")
- '(cljs))))
-
(run-hooks 'cider-connected-hook)))))
(defun cider--disconnected-handler ()
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [nongnu] elpa/cider cade685f1b: Fix cljs type not set correctly (#3282),
ELPA Syncer <=