Function: dape--stack-frame-display

dape--stack-frame-display is a natively compiled function defined in dape.el.

Signature

(dape--stack-frame-display CONN)

Documentation

Update stack frame arrow marker for adapter CONN.

Buffer is displayed with dape-display-source-buffer-action.

Source Code

;; Defined in /nix/store/1fiaif8pifqj2jh65rbg3fkhg3i56q42-emacs-packages-deps/share/emacs/site-lisp/elpa/dape-0.27.1/dape.el
(defun dape--stack-frame-display (conn)
  "Update stack frame arrow marker for adapter CONN.
Buffer is displayed with `dape-display-source-buffer-action'."
  (dape--stack-frame-cleanup)
  (when (dape--stopped-threads conn)
    (cl-labels
        ((displayable-p (source)
           (or (when-let* ((reference
                            (plist-get source :sourceReference)))
                 (< 0 reference))
               (when-let* ((remote-path (plist-get source :path))
                           (filename
                            (dape--file-name-local conn remote-path)))
                 (file-exists-p filename))))
         (displayable-frame-args ()
           (cl-loop with thread = (dape--current-thread conn)
                    with thread-frames = (plist-get thread :stackFrames)
                    with selected = (dape--current-stack-frame conn)
                    for frames on thread-frames
                    when (eq (car frames) selected) return
                    (cl-loop for frame in frames
                             when (displayable-p (plist-get frame :source))
                             return `(,frame
                                      ,(eq frame selected)
                                      ,(eq (car thread-frames) selected))))))
      ;; Check if `displayable-p' frame exist among frames,
      ;; otherwise fetch all (e.g. :supportsDelayedStackTraceLoading
      ;; but frame zero is not displayable)
      (if-let* ((args (displayable-frame-args)))
          (apply #'dape--stack-frame-display-1 conn args)
        (dape--with-request
            (dape--stack-trace
             conn (dape--current-thread conn) dape-stack-trace-levels)
          (when-let* ((args (displayable-frame-args)))
            (apply #'dape--stack-frame-display-1 conn args)))))))