Skip to content

Commit

Permalink
Rename dape--request-return to cps nomenclature
Browse files Browse the repository at this point in the history
  • Loading branch information
svaante committed Oct 14, 2024
1 parent 29415cf commit 8de0fc3
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions dape.el
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,7 @@ See `cl-destructuring-bind' for bind forms."
(declare (indent 1))
`(dape--with-request-bind (&rest _) ,fn-args ,@body))

(defun dape--request-return (cb &optional error)
(defun dape--request-continue (cb &optional error)
"Shorthand to call CB with ERROR in an `dape-request' like way."
(when (functionp cb)
(funcall cb nil error)))
Expand Down Expand Up @@ -1580,14 +1580,14 @@ See `dape-request' for expected CB signature."
(cl-loop for update across updates
for breakpoint in breakpoints do
(dape--breakpoint-update conn breakpoint update))
(dape--request-return cb error)))))
(dape--request-continue cb error)))))

(defun dape--set-exception-breakpoints (conn &optional cb)
"Set the exception breakpoints for adapter CONN.
The exceptions are derived from `dape--exceptions'.
See `dape-request' for expected CB signature."
(if (not dape--exceptions)
(dape--request-return cb)
(dape--request-continue cb)
(dape-request
conn "setExceptionBreakpoints"
`(:filters
Expand Down Expand Up @@ -1623,7 +1623,7 @@ See `dape-request' for expected CB signature."
:exceptionBreakpointFilters)))
(dape--with-request (dape--set-exception-breakpoints conn)
(run-hooks 'dape-update-ui-hook)
(dape--request-return cb)))
(dape--request-continue cb)))

(defun dape--set-breakpoints (conn cb)
"Set breakpoints for adapter CONN.
Expand All @@ -1637,8 +1637,8 @@ See `dape-request' for expected CB signature."
(dape--with-request (dape--set-breakpoints-in-source conn buffer-or-path)
(setf responses (1+ responses))
(when (eq responses (length buffer-or-path-s))
(dape--request-return cb))))
(dape--request-return cb)))
(dape--request-continue cb))))
(dape--request-continue cb)))

(defun dape--set-data-breakpoints (conn cb)
"Set data breakpoints for adapter CONN.
Expand Down Expand Up @@ -1671,9 +1671,9 @@ See `dape-request' for expected CB signature."
;; FIXME Should not remove unverified-breakpoints as they
;; might be verified by another live connection.
(setq dape--data-breakpoints verfied-breakpoints))
(dape--request-return cb error))
(dape--request-continue cb error))
(setq dape--data-breakpoints nil)
(dape--request-return cb)))
(dape--request-continue cb)))

(defun dape--update-threads (conn cb)
"Update threads for CONN in-place if possible.
Expand All @@ -1692,7 +1692,7 @@ See `dape-request' for expected CB signature."
(plist-put old-thread :name (plist-get new-thread :name))
new-thread))
(append threads nil)))
(dape--request-return cb error)))
(dape--request-continue cb error)))

(defun dape--stack-trace (conn thread nof cb)
"Update stack trace in THREAD plist with NOF frames by adapter CONN.
Expand All @@ -1707,7 +1707,7 @@ See `dape-request' for expected CB signature."
(eql current-nof total-frames)
(and delayed-stack-trace-p (<= nof current-nof))
(and (not delayed-stack-trace-p) (> current-nof 0)))
(dape--request-return cb))
(dape--request-continue cb))
(t
(dape--with-request-bind
((&key stackFrames totalFrames &allow-other-keys) error)
Expand All @@ -1734,7 +1734,7 @@ See `dape-request' for expected CB signature."
nil))))
(plist-put thread :totalFrames
(and (numberp totalFrames) totalFrames))
(dape--request-return cb error))))))
(dape--request-continue cb error))))))

(defun dape--variables (conn object cb)
"Update OBJECTs variables by adapter CONN.
Expand All @@ -1744,7 +1744,7 @@ See `dape-request' for expected CB signature."
(zerop variables-reference)
(plist-get object :variables)
(not (jsonrpc-running-p conn)))
(dape--request-return cb)
(dape--request-continue cb)
(dape--with-request-bind
((&key variables &allow-other-keys) _error)
(dape-request conn
Expand All @@ -1755,7 +1755,7 @@ See `dape-request' for expected CB signature."
(thread-last variables
(cl-map 'list 'identity)
(seq-filter 'identity)))
(dape--request-return cb)))))
(dape--request-continue cb)))))


(defun dape--variables-recursive (conn object path pred cb)
Expand All @@ -1768,7 +1768,7 @@ See `dape-request' for expected CB signature."
(or (plist-get object :scopes)
(plist-get object :variables)))))
(if (not objects)
(dape--request-return cb)
(dape--request-continue cb)
(let ((responses 0))
(dolist (object objects)
(dape--with-request (dape--variables conn object)
Expand All @@ -1779,7 +1779,7 @@ See `dape-request' for expected CB signature."
pred)
(when (length= objects
(setf responses (1+ responses)))
(dape--request-return cb)))))))))
(dape--request-continue cb)))))))))

(defun dape--evaluate-expression (conn frame-id expression context cb)
"Send evaluate request to adapter CONN.
Expand Down Expand Up @@ -1847,8 +1847,8 @@ See `dape-request' for expected CB signature."
((&key scopes &allow-other-keys) error)
(dape-request conn "scopes" (list :frameId id))
(plist-put stack-frame :scopes (append scopes nil))
(dape--request-return cb error))
(dape--request-return cb)))
(dape--request-continue cb error))
(dape--request-continue cb)))

(defun dape--update (conn clear display)
"Update adapter CONN data and UI.
Expand Down Expand Up @@ -2379,17 +2379,17 @@ terminate. CONN is inferred for interactive invocations."
(if (and error (not (eq error dape--timeout-error)))
(dape-kill cb 'with-disconnect)
(jsonrpc-shutdown conn)
(dape--request-return cb))))
(dape--request-continue cb))))
((and conn (jsonrpc-running-p conn))
(dape--with-request
(dape-request conn "disconnect"
`( :restart :json-false
,@(when (dape--capable-p conn :supportTerminateDebuggee)
'(:terminateDebuggee t))))
(jsonrpc-shutdown conn)
(dape--request-return cb)))
(dape--request-continue cb)))
(t
(dape--request-return cb))))
(dape--request-continue cb))))

(defun dape-disconnect-quit (conn)
"Kill adapter but try to keep debuggee live.
Expand Down Expand Up @@ -3186,7 +3186,7 @@ See `dape-request' for expected CB signature."
(cond
((or (and (stringp path) (file-exists-p (dape--path-local conn path)) path)
(and (buffer-live-p buffer) buffer))
(dape--request-return cb))
(dape--request-continue cb))
((and (numberp refrence) (< 0 refrence) refrence)
(dape--with-request-bind
((&key content mimeType &allow-other-keys) error)
Expand All @@ -3213,7 +3213,7 @@ See `dape-request' for expected CB signature."
(erase-buffer)
(insert content))
(goto-char (point-min)))
(dape--request-return cb)))))))))
(dape--request-continue cb)))))))))


;;; Stack frame source
Expand Down Expand Up @@ -3756,7 +3756,7 @@ See `dape-request' for expected CB signature."
(cond
;; Current CONN is benched
((member conn dape-info--threads-bench)
(dape--request-return cb))
(dape--request-continue cb))
;; Stopped threads
((setq threads
(cl-remove-if (lambda (thread)
Expand Down Expand Up @@ -3785,9 +3785,9 @@ See `dape-request' for expected CB signature."
(push conn dape-info--threads-bench))
;; When all request have resolved return
(when (length= threads (setf responses (1+ responses)))
(dape--request-return cb))))))
(dape--request-continue cb))))))
;; No stopped threads
(t (dape--request-return cb))))
(t (dape--request-continue cb))))
;; House keeping, no need to keep dead connections in bench
(when dape-info--threads-bench
(let ((conns (dape--live-connections)))
Expand Down

0 comments on commit 8de0fc3

Please sign in to comment.