Skip to content

Commit

Permalink
Move *skip-breaks* reset to wrap-debug to make the intention clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
vspinu committed Jun 3, 2017
1 parent a8ad039 commit 9773df2
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/cider/nrepl/middleware/debug.clj
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@
;; wrong than right.
(update :column #(if (= % 1) 0 %))))
:forms @*tmp-forms*}]
(skip-breaks! nil)
~@body))

(defn break
Expand Down Expand Up @@ -535,9 +534,7 @@
;;; ## Middleware
(defn- maybe-debug
"Return msg, prepared for debugging if code contains debugging macros."
[{:keys [code session ns] :as msg}]
(when (instance? clojure.lang.Atom session)
(swap! session assoc #'*skip-breaks* (atom nil)))
[{:keys [code] :as msg}]
;; The best way of checking if there's a #break reader-macro in
;; `code` is by reading it, in which case it toggles `has-debug?`.
(let [has-debug? (atom false)
Expand Down Expand Up @@ -577,9 +574,11 @@
(transport/send (:transport msg))))

(defn wrap-debug [h]
(fn [{:keys [op input] :as msg}]
(fn [{:keys [op input session] :as msg}]
(case op
"eval" (h (maybe-debug msg))
"eval" (do (when (instance? clojure.lang.Atom session)
(swap! session assoc #'*skip-breaks* (atom nil)))
(h (maybe-debug msg)))
"debug-instrumented-defs" (instrumented-defs-reply msg)
"debug-input" (when-let [pro (@promises (:key msg))]
(swap! promises dissoc (:key msg))
Expand Down

0 comments on commit 9773df2

Please sign in to comment.