-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
suggest-libspec is suggesting clojure.math as clj only in cljc files #408
Comments
Hi @dgtized , good to see you here. Can you attach the nrepl logs as well? Thanks - V |
Not sure if this is the right log, I toggled |
Yes, that's very useful as it includes the entire I'll try to give it a shot, if there are no news, feel free to nudge. Or if you'd be willing, you can try reproducing the bug by adding that data to refactor-nrepl/test/refactor_nrepl/ns/suggest_libspecs_test.clj Lines 51 to 60 in 4a873ca
|
Expected behavior
Typing math/ in a CLJC file should insert the libspec
[clojure.math :as math]
into the ns form.Actual behavior
The libspec inserted is
#?(:clj [clojure.math :as math])
.Steps to reproduce the problem
Using clj-refactor in a CLJC file type
math/
in a namespace with no existing alias named math.Commentary
This is using a default
cljr-magic-require-namespaces
which does not specify clojure.math as:only ("clj")
but does include it as a magic namespace. This works correctly forclojure.set :as set
andclojure.string :as str
and evenclojure.walk
andclojure.zip
, which are also listed in the magic namespaces, so it's confusing thatclojure.math
behaves differently. The project I'm testing with has a mixture of cljs and cljc files but has no instances where the math libspec is wrapped in a reader conditional. It does correctly return clojure.math :as math in cljs files in that project, but add the unnecessary :clj language conditional ifmath/
invokescljr-slash
in a CLJC file.Note that clojure.math is one of the CLJS namespaces that is magically mapped to the equivalent namespace in Clojure as described in https://clojurescript.org/guides/ns-forms#_clojure_namespace_aliasing. I don't know if that's related but it seems like it might be.
Environment & Version information
clj-refactor.el and refactor-nrepl version information
clj-refactor 3.11.3, refactor-nrepl 3.10.0
CIDER version information
Emacs version
GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38, cairo version 1.18.0) of 2024-05-08
Operating system
Ubuntu 23.10
The text was updated successfully, but these errors were encountered: