This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-05-19
Channels
- # announcements (12)
- # aws (17)
- # babashka (6)
- # beginners (40)
- # cider (14)
- # cljs-dev (14)
- # cljsrn (8)
- # clojure (110)
- # clojure-europe (46)
- # clojure-italy (1)
- # clojure-nl (4)
- # clojure-spec (14)
- # clojure-sweden (3)
- # clojure-uk (29)
- # clojurescript (52)
- # conjure (68)
- # cursive (33)
- # datomic (9)
- # figwheel-main (11)
- # fulcro (97)
- # ghostwheel (1)
- # graalvm (2)
- # helix (53)
- # hoplon (13)
- # joker (6)
- # kaocha (1)
- # leiningen (2)
- # meander (28)
- # mid-cities-meetup (1)
- # observability (1)
- # off-topic (112)
- # pathom (6)
- # pedestal (3)
- # re-frame (16)
- # reagent (16)
- # reitit (2)
- # shadow-cljs (27)
- # spacemacs (2)
- # sql (26)
- # testing (3)
- # utah-clojurians (3)
- # vim (2)
- # xtdb (32)
I've got a problem where cider-connect-cljs
from a .cljs
file is creating a repl buffer with type clj
and I'm not able to evaluate anything from the clojurescript buffer. There's no error. Just, nothing happens.
It's happening here. I found this with a debug-on-entry
on cider-set-repl-type
(defun cider-repl--state-handler (response)
"Handle server state contained in RESPONSE."
(with-demoted-errors "Error in `cider-repl--state-handler': %s"
(when (member "state" (nrepl-dict-get response "status"))
(nrepl-dbind-response response (repl-type changed-namespaces)
(when (and repl-type cider-repl-auto-detect-type)
(cider-set-repl-type repl-type))
(unless (nrepl-dict-empty-p changed-namespaces)
(setq cider-repl-ns-cache (nrepl-dict-merge cider-repl-ns-cache changed-namespaces))
(dolist (b (buffer-list))
(with-current-buffer b
;; Metadata changed, so signatures may have changed too.
(setq cider-eldoc-last-symbol nil)
(when (or cider-mode (derived-mode-p 'cider-repl-mode))
(when-let* ((ns-dict (or (nrepl-dict-get changed-namespaces (cider-current-ns))
(let ((ns-dict (cider-resolve--get-in (cider-current-ns))))
(when (seq-find (lambda (ns) (nrepl-dict-get changed-namespaces ns))
(nrepl-dict-get ns-dict "aliases"))
ns-dict)))))
(cider-refresh-dynamic-font-lock ns-dict))))))))))
From what I can gather, cider-connect-cljs
gives the newly created REPL buffer a temporary type, pending-cljs
, does some work, then adjusts the buffer's name/type based on something it figures out from the repl command? For some reason, even though I'm starting with the cider-connect-cljs
command and giving it a shadow
type, it's still resulting in a clj
buffer.
Debugger entered--entering a function:
* cider-set-repl-type("clj")
* cider-repl--state-handler((dict ... ;;**** This response has :repl-type clj
* nrepl-client-filter(#<process nrepl-connection> "ender for Clojure.\"2:fn4:truee3:spyd8:arglists64:(...")
accept-process-output(nil 0.01)
nrepl-send-sync-request(("op" "eval" "code" "(require 'cljs.core)") #
...
cider-library-present-p("cljs.core")
cider-verify-clojurescript-is-present()
cider--check-cljs(shadow)
So cider is setting my repl type to clj
because my repl is including :repl-type clj
in its response when nrepl-send-sync-request
is called?
I manually change the repl type to cljs with (cider-set-repl-type 'cljs)
and then evaluate a form in a cljs buffer and the debug-on-entry on cider-set-repl-type
gets hit again and it changes the repl buffer back to clj because the nrepl response includes :repl-type clj
.
The REPL type is set automatically after each request, so there’s little point in trying to force it manually. Most likely something’s not properly setup with the project. For starters - make sure you’re using the most recent shadow-cljs and CIDER.
Any idea on a next step after that? I'm using shadow-cljs 2.8.107 and cider 0.25.0-alpha1, which are the latest from what I can tell.
You can take a look at the nREPL message exchange and see if there’s something weird there.
https://docs.cider.mx/cider/troubleshooting.html#_debugging_the_communication_with_nrepl
Hi! Is there a way to force clj-refactor to use for eg. deps.edn over project.clj if both exist at project root ?
Maybe in dirs-local.el ?
When I use for eg. cljr-add-project-dependency
, I get cljr--insert-into-leiningen-dependencies: Search failed: ":dependencies"
error because as I understand project.clj takes priority over deps.edn.
https://github.com/clojure-emacs/clj-refactor.el/blob/8259791e054382457b87d1f78061b5e3ce948907/clj-refactor.el#L818
@admin055 If you have more than one project configuration file (project.clj, deps.edn, build.boot) then cider-jack-in commands should display a prompt allowing you to choose which configuration to use. To specify the default project configuration for CIDER, create a dir-locals.el file in the root of your project directory containing the following
((clojure-mode . ((cider-preferred-build-tool . "clojure-cli"))))
I have not tested this with clj-refactor as I stopped using that library a long while ago. If it doesnt work wth clj-refactor, then consider raising an issue or better yet a PR.If using Clojure CLI tools you can also set default aliases too, for example
((clojure-mode . ((cider-clojure-cli-global-options . "-A:fig"))))
https://practicalli.github.io/blog/posts/cider-jack-in-to-clojure-cli-projects-from-spacemacs/And if you have multiple clojure projects under one git repository, you can tell projectile to treat them all as Clojure projects using
((nil . ((projectile-project-type . clojure-cli))))
https://practicalli.github.io/spacemacs/clojure-projects/monorepo-nested-projects.html