From 8de0fc359c4041c64b5de944210a93f7debb6525 Mon Sep 17 00:00:00 2001 From: Daniel Pettersson Date: Mon, 14 Oct 2024 22:26:57 +0200 Subject: [PATCH] Rename dape--request-return to cps nomenclature --- dape.el | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/dape.el b/dape.el index 50548d7..f3be4c1 100644 --- a/dape.el +++ b/dape.el @@ -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))) @@ -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 @@ -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. @@ -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. @@ -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. @@ -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. @@ -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) @@ -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. @@ -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 @@ -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) @@ -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) @@ -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. @@ -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. @@ -2379,7 +2379,7 @@ 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" @@ -2387,9 +2387,9 @@ terminate. CONN is inferred for interactive invocations." ,@(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. @@ -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) @@ -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 @@ -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) @@ -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)))