Skip to content

Commit 24892f9

Browse files
committed
Make sure to request less variables than the available one
Fixes #728
1 parent 3f81a4f commit 24892f9

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

dap-ui.el

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ array variables."
832832
(dap--resp-handler)
833833
session))
834834

835-
(defun dap-ui-render-variables (debug-session variables-reference indexed-variables _node)
835+
(defun dap-ui-render-variables (debug-session variables-reference &optional indexed-variables named-variables _node)
836836
"Render hierarchical variables for treemacs.
837837
Usable as the `treemacs' :children argument, when DEBUG-SESSION
838838
and VARIABLES-REFERENCE are applied partially.
@@ -845,14 +845,19 @@ adapter for acquiring nested variables and must not be 0."
845845
(when (dap--session-running debug-session)
846846
(->> (apply #'dap-request debug-session "variables"
847847
:variablesReference variables-reference
848-
(when (and indexed-variables
849-
(< 0 indexed-variables))
850-
(list :start 0
851-
:count dap-ui-default-fetch-count)))
848+
(append (when (and indexed-variables (< 0 indexed-variables))
849+
(list :start 0
850+
:filter "indexed"
851+
:count (1- (min indexed-variables dap-ui-default-fetch-count))))
852+
(when (and named-variables (< 0 indexed-variables))
853+
(list :start 0
854+
:filter "named"
855+
:count (1- (min named-variables dap-ui-default-fetch-count))))))
852856
(gethash "variables")
853857
(-map (-lambda ((&hash "value" "name"
854858
"variablesReference" variables-reference
855-
"indexedVariables" indexed-variables))
859+
"indexedVariables" indexed-variables
860+
"namedVariables" named-variables))
856861
`(:label ,(concat (propertize (format "%s" name)
857862
'face 'font-lock-variable-name-face)
858863
": "
@@ -869,7 +874,7 @@ adapter for acquiring nested variables and must not be 0."
869874
,@(unless (zerop variables-reference)
870875
(list :children
871876
(-partial #'dap-ui-render-variables debug-session
872-
variables-reference indexed-variables)))))))))
877+
variables-reference indexed-variables named-variables)))))))))
873878

874879
(defun dap-ui-render-value
875880
(debug-session expression value variables-reference)

0 commit comments

Comments
 (0)