Skip to content

Commit 575cdc0

Browse files
committed
lispy-clojure.cljs: Add shadow- functionality
Currently, the middleware injection relies on a fork of nrepl/piggieback, since ClojureScript is quite weak (doesn't have a true eval as far as I can see). So we do the shadow stuff in cider.piggieback/evaluate.
1 parent 9c4d3aa commit 575cdc0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lispy-clojure.cljs

+15
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,18 @@
4343
(fn [x] (or (re-find #"__|constructor|[$]" x)
4444
(re-matches #"[0-9]+" x)))
4545
(vec (js/Object.getOwnPropertyNames o))))))))))
46+
47+
(defn shadow-map []
48+
(or
49+
(aget js/window "shadows")
50+
(set! (. js/window -shadows) {})))
51+
52+
(defn shadow-unmap [nspc]
53+
(set! (. js/window -shadows) {}))
54+
55+
(defn shadow-def
56+
"Give SYM in *ns* shadow value EXPR."
57+
[sym expr]
58+
(set! (. js/window -shadows)
59+
(assoc (shadow-map) (name sym) expr))
60+
expr)

0 commit comments

Comments
 (0)