|
12 | 12 | ;; of course breaks when suitable.complete-for-nrepl is renamed(!).
|
13 | 13 | (def dummy-var)
|
14 | 14 | (def this-ns (:ns (meta #'dummy-var)))
|
15 |
| -(def munged-js-introspection-ns (string/replace (name (clojure.core/ns-name this-ns)) #"complete-for-nrepl$" "js-introspection")) |
16 |
| -(def munged-js-introspection-js-name (symbol (string/replace munged-js-introspection-ns #"-" "_"))) |
| 15 | + |
| 16 | +(defn munged-js-introspection-ns [] |
| 17 | + (suitable.js-completions/js-introspection-ns)) |
| 18 | + |
| 19 | +(defn munged-js-introspection-js-name [] |
| 20 | + (-> (munged-js-introspection-ns) |
| 21 | + (string/replace #"-" "_") |
| 22 | + symbol)) |
17 | 23 |
|
18 | 24 | ;; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
|
19 | 25 |
|
|
143 | 149 | (when (not= "true" (some-> (cljs-evaluate-fn
|
144 | 150 | renv "<suitable>" 1
|
145 | 151 | ;; see above, would be suitable.js_introspection
|
146 |
| - (format "!!goog.getObjectByName('%s')" munged-js-introspection-js-name)) :value)) |
| 152 | + (format "!!goog.getObjectByName('%s')" (munged-js-introspection-js-name))) :value)) |
147 | 153 | (try
|
148 | 154 | ;; see above, would be suitable.js-introspection
|
149 |
| - (cljs-load-namespace-fn renv (read-string munged-js-introspection-ns) opts) |
| 155 | + (cljs-load-namespace-fn renv (read-string (munged-js-introspection-ns)) opts) |
150 | 156 | (catch Exception e
|
151 | 157 | ;; when run with mranderson, cljs does not seem to handle the ns
|
152 | 158 | ;; annotation correctly and does not recognize the namespace even
|
153 | 159 | ;; though it loads correctly.
|
154 |
| - (when-not (and (string/includes? munged-js-introspection-ns "inlined-deps") |
| 160 | + (when-not (and (string/includes? (munged-js-introspection-ns) "inlined-deps") |
155 | 161 | (string/includes? (string/lower-case (str e)) "does not provide a namespace"))
|
156 | 162 | (throw e))))
|
157 | 163 | (cljs-evaluate-fn renv "<suitable>" 1 (format "goog.require(\"%s\");%s"
|
158 |
| - munged-js-introspection-js-name |
| 164 | + (munged-js-introspection-js-name) |
159 | 165 | (if debug? " console.log(\"suitable loaded\");" "")))
|
160 | 166 | ;; wait as depending on the implemention of goog.require provide by the
|
161 | 167 | ;; cljs repl might be async. See
|
|
0 commit comments