Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore autoloads correctly #756

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions dap-ui.el
Original file line number Diff line number Diff line change
Expand Up @@ -781,10 +781,49 @@ DEBUG-SESSION is the debug session triggering the event."
debug-session
variables-reference)))))))))

(defun dap-ui--most-specific-locals (session &optional parent-variables-reference)
""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you document this function and the other one below? Thanks!

(if parent-variables-reference
(when (and (dap--session-running session)
parent-variables-reference
(not (zerop parent-variables-reference)))
(->> parent-variables-reference
(dap-request session "variables" :variablesReference)
(gethash "variables")
(-filter (-lambda ((&hash "expensive"))
(or (null expensive) (not expensive))))
(-map (-lambda ((&hash "name" "value" "line" "column" "variablesReference" variables-reference))
(if-let ((children (dap-ui--most-specific-locals session variables-reference)))
(ht ("name" name)
("value" value)
("line" line)
("column" column)
("children" children))
(ht ("name" name)
("line" line)
("column" column)
("value" value)))))))
(-some->> session
(dap--debug-session-active-frame)
(gethash "id")
(dap-request session "scopes" :frameId)
(gethash "scopes")
(-map (-lambda ((&hash "variablesReference" variables-reference))
(dap-ui--most-specific-locals session variables-reference)))
(-flatten))))

(defun dap-ui-refresh-inline-locals ()
""
(-when-let* ((session (dap--cur-session))
(specific-locals (dap-ui--most-specific-locals session)))
(message "%s" (dap--json-encode specific-locals))))

(defvar dap-ui--locals-timer nil)

(defun dap-ui-locals--refresh (&rest _)
"Refresh local variables from current debug session."
(save-excursion
(dap-ui-refresh-inline-locals)
(setq dap-ui--locals-timer nil)
(with-current-buffer (get-buffer-create dap-ui--locals-buffer)
(or (-some--> (dap--cur-session)
Expand Down