Function: dape--update

dape--update is a natively compiled function defined in dape.el.

Signature

(dape--update CONN &optional INVALIDATE DISPLAY-SOURCE-P)

Documentation

Update adapter CONN data and UI.

Use INVALIDATE to invalidate stack-frames or variables. If DISPLAY-SOURCE-P is non-nil, display displayable top frame.

Source Code

;; Defined in /nix/store/1fiaif8pifqj2jh65rbg3fkhg3i56q42-emacs-packages-deps/share/emacs/site-lisp/elpa/dape-0.27.1/dape.el
(defun dape--update (conn &optional invalidate display-source-p)
  "Update adapter CONN data and UI.
Use INVALIDATE to invalidate `stack-frames' or `variables'.
If DISPLAY-SOURCE-P is non-nil, display displayable top frame."
  ;; Invalidate parts of each thread's data
  (when invalidate
    (dolist (thread (dape--threads conn))
      (pcase invalidate
        ('stack-frames
         (setf (plist-get thread :stackFrames) nil
               (plist-get thread :totalFrames) nil))
        ('variables
         (dolist (frame (plist-get thread :stackFrames))
           (setf (plist-get frame :scopes) nil))))))
  ;; Hydrate current thread's data (unless cached)
  (dape--with-request (dape--stack-trace conn (dape--current-thread conn) 1)
    (when display-source-p
      ;; Display source ASAP (top frame has just been acquired)
      (dape--stack-frame-display conn))
    (dape--with-request (dape--scopes conn (dape--current-stack-frame conn))
      ;; Scopes buffers needs scopes in place... for some reason
      (run-hooks 'dape-update-ui-hook))))