Closed zackteo closed 4 years ago
Yeah I feel it can be pretty misleading cause without cider-eval-buffer
I will just go to (error "Couldn't find reference to %s in book index" symbol)
which caused quite a fair bit of confusion
But yes, do want to just say thanks for your package!!
Hi there!
You're describing quite a strange behaviour.
On my setup, I do not have the need to cider-eval-buffer
any clj(s|c) source file for the command to work. I only need to ensure that a cider session is started. If it's not the case I get error user-error: No clj(s) REPLs in current session "cljr/<project>:localhost:<port>"
.
I assume this might be an issue w/ your project configuration. Does resolving project symbols i your cider REPL works without having to cider-eval-buffer
?
On my clojure projects, using leiningen, I have [cider/cider-nrepl "0.25.0-alpha1"]
in my :plugins
. For cljs, I use shadow-cljs w/ leiningen integration and without any emacs specific configuration.
Okay so if I don't have CIDER open I get No Linked CIDER Sessions
With regards to symbol resolving, I'm not sure what might that entail. Things won't be fully syntax highlighted yet. But lispy jump to symbol
works - guess symbols aren't automatically resolved with CIDER launch
Yeah it might be due to the lack thereof plugins, doing exercism exercises so project.clj
looks like
(defproject beer-song "0.1.0-SNAPSHOT"
:description "beer-song exercise."
:url "https://github.com/exercism/clojure/tree/master/exercises/beer-song"
:dependencies [[org.clojure/clojure "1.10.0"]])
But I think there is no longer that need to have it in the config - even for the global one https://docs.cider.mx/cider/0.26/basics/middleware_setup.html#using-leiningen
"In the past, if you were setting up CIDER, you might have had to modify profiles.clj or profile.boot. CIDER now handles everything automatically and you donβt need to add anything special to these files. The same is true of your deps.edn file."
Oh ok, I'm starting to understand.
This has to do with filename / ns mapping.
Resolution of str/join
in src/example.clj
doesn't work.
But if I modify src/beer_song.clj
to look like this:
(ns beer-song
(:require [clojure.string :as str]))
;; [...]
(defn test []
(str/join ", " [1 2 3]))
Lookup of str/join
works.
This is because file src/example.clj
is declared with ns beer-song
, which is kinda wrong.
If I rename the ns declaration in src/example.clj
to match the file name:
(ns example ; changed here
(:require [clojure.string :as str]))
;; [...]
Now lookup of str/join
in src/example.clj
works as well.
By doing cider-eval-buffer
you force the evaluation of a file that wasn't evaluated at startup, forcing the resolution to work.
In the case of the exercism example project, I'd say they are doing things the "wrong" way. But a similar use-case can happen when doing interactive development and adding a new source / ns without requiring it in another ns end re-evaluation this require.
And indeed you're right, the explicit dependency of the cider-nrpel plugin in the leiningen config is no more needed. My projects must have predated this change.
I've added more explicit instructions regarding this use-case: https://github.com/p3r7/clojure-essential-ref/commit/3787300a2f6100d1a20b1259b488256f3a840fa6
@zackteo, I was sounding pretty affirmative in my last message but I'm in fact not 100% sure that what I described corresponded to your use-case.
Could your confirm or infirm?
By doing cider-eval-buffer you force the evaluation of a file that wasn't evaluated at startup, forcing the resolution to work. @p3r7 Yeah my issue was just this part! :) Which you added explicit instructions for
Great.
I guess I can close the ticket then.
I also renamed it to ease finding it back.
Not sure if should have a reminder to do a
cider-eval-buffer
I thought there was an issue with the package at first. πAnd in case people wanna know am using this for my doom config. I think if I put
:after clojure-essential-ref
the packages will e