Skip to content

Commit 19d1af9

Browse files
vemvbbatsov
authored andcommitted
Fix mranderson setup
1 parent 0d4c952 commit 19d1af9

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

src/main/suitable/complete_for_nrepl.clj

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,14 @@
1212
;; of course breaks when suitable.complete-for-nrepl is renamed(!).
1313
(def dummy-var)
1414
(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))
1723

1824
;; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
1925

@@ -143,19 +149,19 @@
143149
(when (not= "true" (some-> (cljs-evaluate-fn
144150
renv "<suitable>" 1
145151
;; 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))
147153
(try
148154
;; 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)
150156
(catch Exception e
151157
;; when run with mranderson, cljs does not seem to handle the ns
152158
;; annotation correctly and does not recognize the namespace even
153159
;; 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")
155161
(string/includes? (string/lower-case (str e)) "does not provide a namespace"))
156162
(throw e))))
157163
(cljs-evaluate-fn renv "<suitable>" 1 (format "goog.require(\"%s\");%s"
158-
munged-js-introspection-js-name
164+
(munged-js-introspection-js-name)
159165
(if debug? " console.log(\"suitable loaded\");" "")))
160166
;; wait as depending on the implemention of goog.require provide by the
161167
;; cljs repl might be async. See

src/main/suitable/js_completions.clj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77

88
(def debug? false)
99

10+
;; mranderson-friendly
11+
(defn js-introspection-ns []
12+
(-> ::_ namespace (replace ".js-completions" ".js-introspection")))
13+
1014
(defn js-properties-of-object
1115
"Returns the properties of the object we get by evaluating `obj-expr` filtered
1216
by all those that start with `prefix`."
@@ -19,9 +23,11 @@
1923
;; to avoid
2024
;; Compile Warning: Use of undeclared Var
2125
;; suitable.js-introspection/property-names-and-types
22-
(let [template "(suitable.js-introspection/property-names-and-types ~A ~S)"
26+
(let [template (str "("
27+
(js-introspection-ns)
28+
"/property-names-and-types ~A ~S)")
2329
code (cl-format nil template obj-expr prefix)]
24-
(cljs-eval-fn ns "(require 'suitable.js-introspection)")
30+
(cljs-eval-fn ns (str "(require '" (js-introspection-ns) ")"))
2531
(cljs-eval-fn ns code))
2632
(catch Exception e {:error e}))))
2733

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy