Function: dape--info-scope-add-variable
dape--info-scope-add-variable is a natively compiled function defined
in dape.el.
Signature
(dape--info-scope-add-variable TABLE OBJECT REFERENCE PATH TEST-EXPANDED &optional NO-HANDLES)
Documentation
Add variable OBJECT with REFERENCE and PATH to TABLE.
TEST-EXPANDED is called with PATH and OBJECT to determine if recursive calls should continue. If NO-HANDLES is non-nil skip + - handles.
Source Code
;; Defined in /nix/store/1fiaif8pifqj2jh65rbg3fkhg3i56q42-emacs-packages-deps/share/emacs/site-lisp/elpa/dape-0.27.1/dape.el
(defun dape--info-scope-add-variable (table object reference path test-expanded
&optional no-handles)
"Add variable OBJECT with REFERENCE and PATH to TABLE.
TEST-EXPANDED is called with PATH and OBJECT to determine if recursive
calls should continue. If NO-HANDLES is non-nil skip + - handles."
(let* ((name (or (plist-get object :name) ""))
(name (if (string-empty-p name)
(or (plist-get object :evaluateName) "")
name))
(type (or (plist-get object :type) ""))
(value (or (plist-get object :value)
(plist-get object :result)
" "))
(prefix (make-string (* (1- (length path)) 2) ?\s))
(path (cons name path))
(expanded-p (funcall test-expanded path))
row)
(setq
name (propertize name
'font-lock-face 'font-lock-variable-name-face
'mouse-face 'highlight
'help-echo "mouse-2: create or remove watch expression"
'keymap dape-info-variable-name-map)
type (propertize type 'font-lock-face 'font-lock-type-face)
value (propertize value
'mouse-face 'highlight
'help-echo "mouse-2: edit value"
'keymap dape-info-variable-value-map)
prefix (cond (no-handles prefix)
((zerop (or (plist-get object :variablesReference) 0))
(concat prefix " "))
((and expanded-p (plist-get object :variables))
(concat
(propertize (concat prefix "-")
'mouse-face 'highlight
'help-echo "mouse-2: contract"
'keymap dape-info-variable-prefix-map)
" "))
((concat
(propertize (concat prefix "+")
'mouse-face 'highlight
'help-echo "mouse-2: expand"
'keymap dape-info-variable-prefix-map)
" ")))
row (dape--info-locals-table-columns-list `((name . ,name)
(type . ,type)
(value . ,value))))
(setcar row (concat prefix (car row)))
(gdb-table-add-row table
(if dape-info-variable-table-aligned
row
(list (mapconcat #'identity row " ")))
`( dape--variable ,object
dape--path ,path
;; `dape--command-at-line' expects non-nil
dape--reference ,(or reference 'nothing)))
(when expanded-p
;; TODO Should be paged
(dolist (variable (plist-get object :variables))
(dape--info-scope-add-variable table variable
(plist-get object :variablesReference)
path test-expanded no-handles)))))