cider icon indicating copy to clipboard operation
cider copied to clipboard

cider-debug-move-here doesn't work in defun that don't have a blank line before them

Open bo-tato opened this issue 1 year ago • 0 comments

Cider debugger's move here command doesn't work in cases like:

(foo 7)
(defn bar []
  (let [x 7
        y 9]
    (-> x
        (+ 1)
        #break (doto println)
        (* 2)
        #break (doto println)
        (/ 3)
        (* y)
        #break (doto println)
        inc
        dec)
    (println "hi")
    (println "bye")))

2023-08-31-231141_1094x391_scrot It's maybe a confusing screenshot with both cider debug on clojure on the left active, and edebug in cider-debug-move-here active on the right, but you can see cider-debug-move-here moved the cursor onto the f of foo. Later it does:

(save-excursion
                  (forward-sexp 1)
                  (> here (point)))

Where it should move point to the end of the function being debugged, but instead (forward-sexp 1) simply moves to the end of the word foo before the start of bar, and cider debug errors with "Point is outside the sexp being debugged".

In this branch I edited cider-debug-move-here so it works in all cases as far as I can tell, but I don't fully understand the motivation behind what the function was doing originally, so maybe my version is misbehaving on some different edgecase.

bo-tato avatar Sep 01 '23 04:09 bo-tato