Skip to content

Commit 06d9de1

Browse files
committed
feat(scopes): add toggling arrows
1 parent 25ffcf3 commit 06d9de1

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

lua/dap-view/scopes/view.lua

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,19 @@ local function show_variables(variables_reference, parent_path, line, depth, can
5757
local show_expand_hint = #variable.value == 0 and variable.variablesReference > 0
5858
local value = show_expand_hint and "..." or variable.value
5959
local variable_name = variable.name
60-
local content = variable_name .. " = " .. value
60+
61+
local path = parent_path .. "." .. variable.name
62+
63+
local prefix = ""
64+
if variable.variablesReference > 0 then
65+
if state.variable_path_is_expanded[path] then
66+
prefix = ""
67+
else
68+
prefix = ""
69+
end
70+
end
71+
72+
local content = prefix .. variable_name .. " = " .. value
6173

6274
-- Can't have linebreaks with nvim_buf_set_lines
6375
local trimmed_content = content:gsub("%s+", " ")
@@ -68,8 +80,6 @@ local function show_variables(variables_reference, parent_path, line, depth, can
6880

6981
hl.hl_range("WatchExpr", { line, depth }, { line, depth + #variable.name })
7082

71-
local path = parent_path .. "." .. variable.name
72-
7383
local prev_variable_value = state.variable_path_to_value[path]
7484

7585
local updated = prev_variable_value and prev_variable_value ~= variable.value

0 commit comments

Comments
 (0)