-
-
Notifications
You must be signed in to change notification settings - Fork 179
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
Preloads with a top-level namespace don't load macros #1167
Comments
I did a quick debug and found the cause in CLJS directly, at least I think so. Basically the fix is to The CLJS code has a path that checks (defn get-expander-ns [env ^String nstr]
;; first check for clojure.* -> cljs.* cases
(let [res (or (resolve-macro-ns-alias env nstr nil)
(resolve-ns-alias env nstr nil))
nstr (if (some? res) (str res) nstr)]
(cond
#?@(:clj [(= "clojure.core" nstr) (find-ns 'cljs.core)]
:cljs [(identical? "clojure.core" nstr) (find-macros-ns impl/CLJS_CORE_MACROS_SYM)])
#?@(:clj [(= "clojure.repl" nstr) (find-ns 'cljs.repl)]
:cljs [(identical? "clojure.repl" nstr) (find-macros-ns 'cljs.repl)])
#?@(:clj [(.contains nstr ".") (find-ns (symbol nstr))]
:cljs [(goog.string/contains nstr ".") (find-macros-ns (symbol nstr))])
:else (some-> env :ns :require-macros (get (symbol nstr)) #?(:clj find-ns
:cljs find-macros-ns)))))
Do you want to try to recreate this issue CLJS only? I can see if I can work around this, but it seems to be entirely in code shadow-cljs doesn't control. |
I'll open a bug with CLJS. Thanks for investigating! |
See https://github.com/lilactown/macro-repl-bug for a reproduction.
I noticed #1059 which seems to be directly related. I changed the code to use more than a single part (e.g.
bug-shadow.macro-repl
) and it resolved the bug.In a project I work on, we have a top-level namespace that we use frequently from the REPL. It would be helpful to have a macro available from within it, but currently this blocks us from easily doing so.
The text was updated successfully, but these errors were encountered: