cljr-magic-require-namespaces doesn't currently allow specifying its intended context (:clj, :cljs).
This can easily cause incorrect suggestions for cljr-slash.
I'd suggest one of the following:
- Introduce new defcustom, e.g.
cljr-jvm-magic-require-namespaces
- This would be a list like
'("clojure.java.io"), specifying which values of cljr-magic-require-namespaces are intended for JVM clojure.
- Same for cljs
- (Preferred) Allow cljr-magic-require-namespaces to also include lists
(defcustom cljr-magic-require-namespaces
'(("set" . "clojure.set")
- ("io" . "clojure.java.io")
+ ("io" "clojure.java.io" "clj")
+ ("io" "foo.io" "cljs")
("str" . "clojure.string")
("walk" . "clojure.walk")
("zip" . "clojure.zip")))
i.e. we could mix and match cons cells (("set" . "clojure.set")) with lists having the extra property ("io" "clojure.java.io" "clj").
Both approaches are intended to be backwards-compatible.
Notes on semantics
- There are two values that must be expressible: clj, cljs
- cljc would be a no-op (since by default, entries already are context-agnostic)
- A value such as
"io" "clojure.java.io" "clj" is intended to mean "please only possibly suggest clojure.java.io if the filename is .clj"
- It does not, however, mean "clojure.java.io is the only acceptable completion if the filename is .clj"
- refactor-nrepl is ultimately responsible for deciding what choice(s) will be offered.
Final decision
#530 (comment)
cljr-magic-require-namespacesdoesn't currently allow specifying its intended context (:clj, :cljs).This can easily cause incorrect suggestions for cljr-slash.
I'd suggest one of the following:
cljr-jvm-magic-require-namespaces'("clojure.java.io"), specifying which values ofcljr-magic-require-namespacesare intended for JVM clojure.(defcustom cljr-magic-require-namespaces '(("set" . "clojure.set") - ("io" . "clojure.java.io") + ("io" "clojure.java.io" "clj") + ("io" "foo.io" "cljs") ("str" . "clojure.string") ("walk" . "clojure.walk") ("zip" . "clojure.zip")))i.e. we could mix and match cons cells (
("set" . "clojure.set")) with lists having the extra property("io" "clojure.java.io" "clj").Both approaches are intended to be backwards-compatible.
Notes on semantics
"io" "clojure.java.io" "clj"is intended to mean "please only possibly suggest clojure.java.io if the filename is .clj"Final decision
#530 (comment)