Skip to content

Commit

Permalink
Don't track instrumented defs in debug.clj
Browse files Browse the repository at this point in the history
  • Loading branch information
Malabarba committed Sep 9, 2015
1 parent faa1726 commit b350819
Showing 1 changed file with 7 additions and 19 deletions.
26 changes: 7 additions & 19 deletions src/cider/nrepl/middleware/debug.clj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
(ns cider.nrepl.middleware.debug
"Expression-based debugger for clojure code"
{:author "Artur Malabarba"}
(:require [clojure.tools.nrepl.transport :as transport]
[clojure.tools.nrepl.middleware :refer [set-descriptor!]]
[clojure.tools.nrepl.misc :refer [response-for]]
[clojure.tools.nrepl.middleware.interruptible-eval :refer [*msg*]]
[cider.nrepl.middleware.util.instrument :as ins]
[cider.nrepl.middleware.inspect :refer [swap-inspector!]]
(:require [cider.nrepl.middleware.inspect :refer [swap-inspector!]]
[cider.nrepl.middleware.stacktrace :as stacktrace]
[cider.nrepl.middleware.util.cljs :as cljs]
[cider.nrepl.middleware.util.inspect :as inspect]
[cider.nrepl.middleware.util.instrument :as ins]
[cider.nrepl.middleware.util.misc :as misc]
[clojure.tools.nrepl.middleware :refer [set-descriptor!]]
[clojure.tools.nrepl.middleware.interruptible-eval :refer [*msg*]]
[clojure.tools.nrepl.misc :refer [response-for]]
[clojure.tools.nrepl.transport :as transport]
[clojure.walk :as walk])
(:import [clojure.lang Compiler$LocalBinding]))

Expand Down Expand Up @@ -285,19 +285,7 @@
(when (instance? clojure.lang.Atom session)
(swap! session update-in [#'*data-readers*] assoc
'dbg #'debug-reader 'break #'breakpoint-reader)
(swap! session assoc #'*skip-breaks* (atom nil))
;; The session atom is reset! after eval, so it's the best way of
;; running some code after eval is done. Since nrepl evals are async
;; we can't just run this code after propagating the message.
(add-watch session ::track-instrumented-defs
(fn [& _]
(try
(when (map? @debugger-message)
(let [ins-defs (into [] (if ns (ins/list-instrumented-defs ns)))]
(debugger-send {:ns ns :status :instrumented-defs
:instrumented-defs (misc/transform-value ins-defs)})
(remove-watch session ::track-instrumented-defs)))
(catch Exception e)))))
(swap! session assoc #'*skip-breaks* (atom nil)))
;; 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

0 comments on commit b350819

Please sign in to comment.