Permalink
Browse files

Update to nrepl 0.2.0-beta9 and add op metadata

  • Loading branch information...
1 parent 65f0083 commit 6f031d5b5040624200d28ec29b94d1b9d1abb6a3 @hugoduncan hugoduncan committed Aug 28, 2012
View
@@ -5,7 +5,7 @@
:test-paths ["src/test/clojure"]
:dependencies [[org.clojure/clojure "1.3.0"]
[org.clojure/data.codec "0.1.0"]
- [org.clojure/tools.nrepl "0.2.0-beta8"]]
+ [org.clojure/tools.nrepl "0.2.0-beta9"]]
:profiles {:it {:source-paths ["src/main/clojure" "src/it/clojure"]
:dependencies [[org.palletops/clojure "1.3.0-p1"]
[org.cloudhoist/pallet "0.6.7"]
@@ -124,8 +124,8 @@
(defn silent-event?
[^Event event]
- (let [^String event-str (try (.toString event)
- (catch java.lang.InternalError _))]
+ (if-let [^String event-str (try (.toString event)
+ (catch java.lang.InternalError _))]
(or (.startsWith event-str "ExceptionEvent@java.net.URLClassLoader")
(.startsWith event-str "ExceptionEvent@java.lang.Class")
(.startsWith event-str "ExceptionEvent@clojure.lang.RT")
@@ -135,7 +135,8 @@
(.startsWith
event-str "ExceptionEvent@com.sun.org.apache.xerces.internal")
(.startsWith
- event-str "ExceptionEvent@com.google.inject.spi.InjectionPoint"))))
+ event-str "ExceptionEvent@com.google.inject.spi.InjectionPoint"))
+ false))
(defn handle-event-set
"NB, this resumes the event-set, so you will need to suspend within
@@ -181,7 +181,12 @@ connection is found in the connections map based on the session id."
:err new-session (:transport connection))]
(trace "jpda session %s" s)
(bindings-merge! connection s {#'*out* out #'*err* err})))
- (let [transport (:transport connection)]
+ (let [transport (:transport connection)
+ msg (if (and (:ops msg) (:versions msg))
+ (do
+ ;; assume this is a reply to the "describe" op
+ )
+ msg)]
(assert transport)
(transport/send transport msg)))
(trace "Reply forwarded"))
@@ -10,6 +10,7 @@
ritz.repl-utils.doc) ;; ensure commands are loaded
(:use
[clojure.tools.nrepl.misc :only [response-for]]
+ [clojure.tools.nrepl.middleware :only [set-descriptor!]]
[clojure.tools.nrepl.middleware.interruptible-eval :only [*msg*]]
[ritz.connection :only [bindings bindings-assoc!]]
[ritz.logging :only [trace]]))
@@ -149,3 +150,61 @@
[handler]
(fn [msg]
(debug-eval* handler msg)))
+
+(set-descriptor!
+ #'debug-eval
+ {:handles
+ {"break-on-exception"
+ {:doc
+ (str "Flag to control whether exceptions break into the debugger.")
+ :requires
+ {"flag" "A boolean true or false"}
+ :returns {"status" "done"}}
+ "invoke-restart"
+ {:doc
+ (str "Invoke the specified restart number or name for the specified "
+ "thread.")
+ :requires
+ {"thread-id" "The thread executing the code to disassemble."
+ "restart-number" "The (ordinal) number of the restart to invoke"
+ "restart-name" "The name of the restart to invoke."}
+ :returns {"status" "done"}}
+ "frame-eval"
+ {:doc
+ (str "Evaluate code with in the locals environment of the specified frame.")
+ :requires
+ {"thread-id" "The thread executing the code to disassemble."
+ "frame-number" "The stack frame to return locals for."
+ "code" "The expression to evaluate"}
+ :returns {"status" "done"}
+ :optional {"pprint" "Flag to specify pretty-printing of the result"}}
+ "frame-source"
+ {:doc
+ (str "Locate the source code for the specified frame. The location is "
+ "passed back in a name value list specifying file, zip, and line "
+ "number.")
+ :requires
+ {"thread-id" "The thread executing the code to disassemble."
+ "frame-number" "The stack frame to return locals for."}
+ :returns {"status" "done"}}
+ "frame-locals"
+ {:doc
+ (str "List the local variables visible in the specified frame. "
+ "Each local is presented in a list with name and value "
+ "components.")
+ :requires
+ {"thread-id" "The thread executing the code to disassemble."
+ "frame-number" "The stack frame to return locals for."}
+ :returns {"status" "done"}}
+ "disassemble-frame"
+ {:doc "Disassemble the code associated with the specified frame."
+ :requires
+ {"thread-id" "The thread executing the code to disassemble."
+ "frame-number" "The stack frame to disassemble."}
+ :returns {"status" "done"}}
+ "jpda"
+ {:doc
+ (str "Evaluate code in the debugger's own VM.")
+ :requires
+ {"code" "A boolean true or false"}
+ :returns {"status" "done"}}}})
@@ -1,6 +1,9 @@
(ns ^{:author "Chas Emerick"}
ritz.nrepl.pr-values
- (:require [clojure.tools.nrepl.transport :as t])
+ (:require
+ [clojure.tools.nrepl.transport :as t])
+ (:use
+ [clojure.tools.nrepl.middleware :only [set-descriptor!]])
(:import clojure.tools.nrepl.transport.Transport))
(defn pr-values
@@ -25,3 +28,12 @@
resp))))))
(h msg)))))
([] (pr-values #{"eval"})))
+
+(set-descriptor! #'pr-values
+ {:doc
+ (str
+ "Modifies the transport to modify the value in the :value key with its "
+ "printed representaton.")
+ :requires #{}
+ :expects #{}
+ :handles {}})
@@ -6,6 +6,7 @@
[clojure.main :as main])
(:use
[clojure.tools.nrepl.misc :only [response-for]]
+ [clojure.tools.nrepl.middleware :only [set-descriptor!]]
[clojure.tools.nrepl.middleware.interruptible-eval :only [*msg*]]
[ritz.connection :only [bindings bindings-assoc!]]
[ritz.logging :only [trace]]))
@@ -55,3 +56,13 @@
(transport/send transport (response-for msg :status #{:error :no-code}))
(evaluate msg))
(handler msg))))
+
+(set-descriptor!
+ #'simple-eval
+ {:handles
+ {"jpda-eval"
+ {:doc
+ (str "Evaluate code in the debugger's own VM.")
+ :requires
+ {"code" "A boolean true or false"}
+ :returns {"status" "ok"}}}})

0 comments on commit 6f031d5

Please sign in to comment.