-
-
Notifications
You must be signed in to change notification settings - Fork 232
Description
Hello!
I really like the calva debugger feature, but most of the code I write in Clojure uses prismatic/schema to define and validate function parameters/schemas/returns etc. and it seems it doesn't work very well with the debugger. (Or I am doing something wrong)
(ns test)
#dbg
(defn sum
[a b]
(+ a b))
(sum a b) ; <- debugs just fine(ns test
(:require [schema.core :as s]))
#dbg
(s/defn sum :- s/Int
[a :- s/Int
b :- s/Int]
(+ a b))
(sum a b) ; <- instantly tries to get into a breakpoint for the definition of 'sum' and weird things happenI made a small sample repo: https://github.com/johnvictorfs/calva-debugger-repro and in the README there's a video of the issue happening
At least to me it seems really easy to reproduce, but it's also a bit inconsistent. Sometimes right after instrumenting the s/defn, resuming the instant breakpoint and then eval a call to it it works, but most of the time it happens the same as in the video below, where I am not able to break into the function when eval'ing (either with #dbg or "Instrument top level form for debugging")
I'm very much not a Clojure expert but digging around I found this in cider-nrepl that seems to attempt to fix this issue? But not totally sure what's happening https://github.com/clojure-emacs/cider-nrepl/blob/ec3e523d215dcae2183d20b6994eec7276751133/src/cider/nrepl/middleware/debug.clj#L596
Appreciate the help in advance!