Skip to content

Commit

Permalink
Remove variable handles for eldoc printing
Browse files Browse the repository at this point in the history
  • Loading branch information
svaante committed Dec 29, 2024
1 parent aa47ded commit a8cb4c0
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions dape.el
Original file line number Diff line number Diff line change
Expand Up @@ -4172,18 +4172,19 @@ current buffer with CONN config."
(push prop columns)))))
(nreverse columns)))

(defun dape--info-scope-add-variable (table object ref path expanded-p)
(defun dape--info-scope-add-variable (table object ref path test-expanded
&optional no-handles)
"Add variable OBJECT with REF and PATH to TABLE.
EXPANDED-P is called with PATH and OBJECT to determine if recursive
calls should stop."
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) ""))
(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 (funcall expanded-p path))
(expanded-p (funcall test-expanded path))
row)
(setq name
(propertize name
Expand All @@ -4203,9 +4204,10 @@ calls should stop."
'keymap dape-info-variable-value-map)
prefix
(cond
(no-handles prefix)
((zerop (or (plist-get object :variablesReference) 0))
(concat prefix " "))
((and expanded (plist-get object :variables))
((and expanded-p (plist-get object :variables))
(concat
(propertize (concat prefix "-")
'mouse-face 'highlight
Expand All @@ -4232,12 +4234,12 @@ calls should stop."
'dape--info-path path
;; `dape--command-at-line' expects non nil
'dape--info-ref (or ref 'refless)))
(when expanded
(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 expanded-p)))))
path test-expanded no-handles)))))

;; FIXME Empty header line when adapter is killed
(define-derived-mode dape-info-scope-mode dape-info-parent-mode "Scope"
Expand Down Expand Up @@ -4276,12 +4278,11 @@ calls should stop."
(setf (gdb-table-right-align table)
dape-info-variable-table-aligned)
do
(dape--info-scope-add-variable
table
object
(plist-get scope :variablesReference)
(list dape--info-scope-index)
#'dape--variable-expanded-p)
(dape--info-scope-add-variable table
object
(plist-get scope :variablesReference)
(list dape--info-scope-index)
#'dape--variable-expanded-p)
finally (insert (gdb-table-string table " ")))))))))


Expand Down Expand Up @@ -5344,8 +5345,8 @@ See `eldoc-documentation-functions', for more information."
#'dape--variable-expanded-p)
(let ((table (make-gdb-table)))
(dape--info-scope-add-variable table (plist-put body :name name)
nil '(hover)
#'dape--variable-expanded-p)
nil '(hover) #'dape--variable-expanded-p
'no-handles)
(funcall cb (gdb-table-string table " ")))))))
t)

Expand Down

0 comments on commit a8cb4c0

Please sign in to comment.