This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-06-26
Channels
- # announcements (6)
- # beginners (328)
- # boot (2)
- # cider (72)
- # clara (6)
- # cljdoc (4)
- # cljsrn (5)
- # clojure (78)
- # clojure-europe (3)
- # clojure-italy (22)
- # clojure-nl (4)
- # clojure-spec (3)
- # clojure-uk (114)
- # clojurescript (22)
- # clojurex (54)
- # copenhagen-clojurians (1)
- # core-async (20)
- # cursive (8)
- # data-science (1)
- # datomic (22)
- # duct (11)
- # emacs (32)
- # events (1)
- # figwheel (2)
- # fulcro (18)
- # graalvm (53)
- # graphql (39)
- # luminus (6)
- # nrepl (6)
- # off-topic (53)
- # om (1)
- # re-frame (8)
- # reagent (19)
- # reitit (3)
- # shadow-cljs (28)
- # spacemacs (10)
- # sql (37)
- # tools-deps (33)
- # vim (9)
- # xtdb (6)
Hm, functions don't font lock dynamically correctly in cljs for me. I rememer that I worked on this like 2 years ago. I wanted to try and see if I can debug and fix it. But now my mind is blank as to how this all worked, with cider-nrepl mostly. How do I most conveniently send input to cider-nrepl and how do I see the output? I want to for example test the function cider.nrepl.middleware.track-state/ns-as-map for a cljs namespace. How would I do that?
the simplest path to some message introspection is nrepl-toggle-message-logging
so you can see what CIDER sends back and forth. Anything beyond that gets a little hairy
@dpsutton Ok! But if I have jacked-in to the cider-nrepl project, which is clj, then how do I test it for cljs?
i don't know how to answer that. I've traced some of that stuff before and its a tower :0
I'm getting this while trying to connect to an nrepl using cider-connect
after following the instructions here (https://github.com/nrepl/piggieback#clojure-cli-aka-toolsdeps), but the link for More information is broken.
WARNING: CIDER requires cider-nrepl to be fully functional. Some features will not be available without it!
More information.
What I'm really trying to do is to connect Cider to a figwheel-main
project using deps.cli
using this figwheel-main
template https://rigsomelight.com/figwheel-main-template/
If I follow the docs https://docs.cider.mx/cider/basics/clojurescript.html#_using_figwheel_main I get error in process filter: Figwheel-main is not available. Please check
which is the place I'm coming from.
@anantpaatra Are you using deps.edn?
I had success just following these instructions https://github.com/bhauman/figwheel-main#setting-up-a-build-with-tools-cli
Have you been able to connect Cider to it? This is my current struggle.
Can you tell me more or less how to connect? I don't see specific instructions on that tutorial. I've been using that exact configuration through the figwheel-main
template without luck.
Just tried it again following that tutorial by hand, and when I cider-jack-in-cljs
I still get that error in process filter: Figwheel-main is not available. Please check
error. š
Hm, I'm hacking on cider-nrepl
, and I'm running tests. If I run all tests, I get an error that I don't get when I run only that files' test, and vice versa.
This is with make test
lein test cider.nrepl.middleware.track-state-test
lein test :only cider.nrepl.middleware.track-state-test/ns-as-map-cljs-test
FAIL in (ns-as-map-cljs-test) (track_state_test.clj:132)
expected: {sym-0 {:arglists ([]), :macro true}, sym-1 {:arglists ([])}, a-var {}, a-fn {:fn "true"}, b-fn {:fn "true"}, c-fn {:fn "true"}}
actual: ({a-fn {:fn "true"}, b-fn {}, c-fn {}, a-var {}, sym-1 {:arglists ([])}, sym-0 {:arglists ([]), :macro true}})
And this is with lein test cider.nrepl.middleware.track-state-test
lein test cider.nrepl.middleware.track-state-test
lein test :only cider.nrepl.middleware.track-state-test/update-and-send-cache-test
FAIL in (update-and-send-cache-test) (track_state_test.clj:38)
expected: (< 100 (count new-data))
actual: (not (< 100 74))
lein test :only cider.nrepl.middleware.track-state-test/update-and-send-cache-test
FAIL in (update-and-send-cache-test) (track_state_test.clj:42)
expected: (< 100 (count changed-namespaces))
actual: (not (< 100 73))
I had an error in ns-as-map-cljs-test
at first, when running just that file. But then I fixed it, and I'm pretty sure it's right now. So why do I get the error when running with make test
? The output I could see in actual
was different, even when it was wrong in both.https://github.com/clojure-emacs/cider-nrepl/issues/390 The track state bug happens because we are using the thing under test in the tests. Running all tests loads more namespaces than just running an individual file.
Also, I haven't touched update-and-send-cache
so it shouldn't be failing, I reckon. š
And when running from CIDER I get 0 errors
(run-tests *ns*)
Testing cider.nrepl.middleware.track-state-test
Ran 7 tests containing 34 assertions.
0 failures, 0 errors.
{:test 7, :pass 34, :fail 0, :error 0, :type :summary}
@anantpaatra The check thatās failing for you is pretty basic:
(defun cider-check-figwheel-main-requirements ()
"Check whether we can start a Figwheel ClojureScript REPL."
(cider-verify-piggieback-is-present)
(unless (cider-library-present-p "figwheel.main")
(user-error "Figwheel-main is not available. Please check )))
You can try suppressing the requirements check by setting cider-check-cljs-repl-requirements
to nil, but if figwheel-main is truly missing that wonāt help you much. š
After many hours I have just found https://github.com/clojure-emacs/cider/issues/2597 and managed to fix it by setting cider-clojure-cli-global-options
to -R:fig
because it was in an alias (I don't know why I thought it would pick this up magically). Now that I have understood what was wrong it seems basic but do you think its the case to document this nuance of using tools.deps
with cider
somewhere? Others may fall into this trap. Thanks š
It's not mentioned in the README for the figwheel template (maybe I could suggest that) or in the figwheel tutorial and even the cider docs (at least I couldn't find it).
This composition of aliases is a fairly new concept that isn't contemplated in many tutorials. Sean Corfield has a new screencast that was pretty enlightening to me and I believe may even be linked somewhere in the docs.
> Now that I have understood what was wrong it seems basic but do you think its the case to document this nuance of using tools.deps
with cider
somewhere? Others may fall into this trap. Thanks š
@anantpaatra yeah, I guess we should. I was under the impression most people just put figwheel.main in their main deps.
There are several way to approach this, btw - we can also put the clojurescript deps in cider-jack-in-cljs
. Thatās not hard to do, but then people will have to know that cider might be injecting different versions of the deps overriding what they have in their projects.
Maybe when the user selects figwheel-main
during cider-jack-in-cljs
it could test to see if it is available? Hmm, maybe not. That could hide a problem in the user configuration or usage. Perhaps just updating the error message to state something like "figwheel.main wasn't found. If you're not declaring it as a main dependency, make sure you're passing it with -R:<alias>".
@anantpaatra The checks happens at a point where you donāt know how the REPL was started exactly, thatās why we check for the presence of the namespace only.
A sophisticated check is way too involved as we have to take into account many nuances for each build tool and I have think there are more important areas of improvements we can focus on. š
I think for now just adding something in the docs about tools.deps
would be helpful for most people.
I understand and agree š
@bozhidar You don't happen to know what's up with the inconsistencies with the tests I described above?
lein test
is not very useful with cider-nrepl as I donāt think it gets bound to meaningful profile. I think we donāt have anything in the dev profile.
make test
is running the tests using a build with inlined deps and finally what you would run straight from CIDER is a build using whatever is currently loaded.
Generally the results from make test
and running tests within CIDER should be consistent unless you ended up using something that gets inlined in the tests (this would pass in CIDER and fail otherwise).
Generally while I develop cider-nrepl are run the tests from within CIDER and I just confirm in the end with make test that everythingās ok.
Unfortunately inlining deps and the need to support several Clojure and ClojureScript releases makes something thatās typically simple quite complexā¦
There are profiles for each supported Clojure version 1.8-1.10. Generally our support policy is the last 3 versions of Clojure.
If anyone wants to pick up the failing tests on CIDER, there seem to be two issues 1) the linter is linting a string of clojure code. Figure out a way to not change this string but inhibit the linter? Alternatively, collapse onto a single line or just accept the weird lint suggestions to fix 2) the tests OOM on emacs-master. I can't run tests locally and now CI successfully can't run them either. No idea why this is happening but there's something there
> 1) the linter is linting a string of clojure code. Figure out a way to not change this string but inhibit the linter? Alternatively, collapse onto a single line or just accept the weird lint suggestions to fix
ah, it probably thinks its a docstring
diff -u --label /root/project/cider-client.el --label \#\<buffer\ cider-client.el\> /root/project/cider-client.el /tmp/buffer-content-2698iXy
--- /root/project/cider-client.el
+++ #<buffer cider-client.el>
@@ -401,17 +401,17 @@
(defconst cider-info-form "
(do
- (require ')
- (require 'clojure.walk)
+ (require ')
+ (require 'clojure.walk)
- (if-let [var (resolve '%s)]
- (let [info (meta var)]
- (-> info
- (update :ns str)
- (update :name str)
- (update :file (comp str ))
- (assoc :arglists-str (str (:arglists info)))
- (clojure.walk/stringify-keys)))))
+ (if-let [var (resolve '%s)]
+ (let [info (meta var)]
+ (-> info
+ (update :ns str)
+ (update :name str)
+ (update :file (comp str ))
+ (assoc :arglists-str (str (:arglists info)))
+ (clojure.walk/stringify-keys)))))
")
Maybe we can load those forms from a dedicated file or suppress this type of warnings. Unfortunately the lint weāre using is pretty basic and customizations there are problematic. I remember it wasnāt respecting .dir-locals.el last time I checked.
Generally I was hoping to find a way to just have all the forms in a Clojure file from which we load them into user
(or whatever) and simply refer to their var names in the Elisp code.
> 2) the tests OOM on emacs-master. I canāt run tests locally and now CI successfully canāt run them either. No idea why this is happening but thereās something there
I'm busy tonight but i can get back to it on thursday. Really looking forward to green tests across the board š
I really appreciate you taking the time to work on this, as Iāve been pretty busy most of May and June and the work on CIDER stagnated a bit.


Hopefully things are going to pick up in July and August, as Iām hoping to unveil the next CIDER release at āHeart of Clojureā or āClojure/southā.
Iām having a few issues with Emacs picking up settings from my .dir-locals.el file, from the emacs docs, I would have thought that this would set the variables globally, but they are only set in a cider repl buffer. Any one seen this before. My .dir-locals.el is:
((nil . ((cider-ns-refresh-after-fn . "dev-extras/resume")
(cider-ns-refresh-before-fn . "dev-extras/suspend")
(cider-repl-init-code . ("(dev)"))
(cider-clojure-cli-global-options . "-A:dev")))
I can get things working be running a set-variable on the variables, but would be nice not to have to do this every time I ran emacs.