lua-debug icon indicating copy to clipboard operation
lua-debug copied to clipboard

Automatically expand variable scope tabs

Open moon6969 opened this issue 4 years ago • 3 comments

When stepping in debugger, variable scopes (Parameter, Local, etc.) do not automatically expand - even if they were previously expanded... LuaScope1 "Local" starts closed... LuaScope2 So I open "Local" and Continue (F5)... LuaScope3 No locals defined yet... LuaScope4 "Local" is closed again :disappointed: LuaScope5

My suggestion is something like this...

        {
            "type": "lua",
            "request": "launch",
            ...
            autoExpand.local: true,
            autoExpand.parameter: true,
            autoExpand.upvalue: true,
            autoExpand.global: false,
            autoExpand.standard: false,
        },

It would also be good if the scope stayed visible even if it is empty. Currently if there are no locals, the "Local" scope disappears - I think it should always be visible.

moon6969 avatar May 28 '20 19:05 moon6969

Automatically expand is the behavior of VSCode, DA(lua-debug) only provides scope for whether it is expensive. This tag will affect whether VSCode will automatically expand, but it is not decisive.Currently only global and standard are expensive.

actboy168 avatar May 29 '20 01:05 actboy168

Thank you for quick reply.

This issue was raised to vscode for similar issue with Python debugger... In debug mode, arguments are by default collapsed #32199 In particular this comment indicates it is in control of the debugger... https://github.com/Microsoft/vscode/issues/32199#issuecomment-321597173 Here is how it works with Python debugger now:

At first break-point, "Locals" is expanded automatically... PythonScope1

Upon stepping into the function, there are no local variables, but the "Locals" scope is still visible and expanded (v) even though it's empty. PythonScope2

Next step, the y: 'xo' line is automatically visible ✔️ PythonScope3

I think the issue is that for Lua, the "Local" scope is removed when empty?

Thanks for your debugger - it's very useful 👍

moon6969 avatar May 30 '20 17:05 moon6969

There are currently seven scopes. If it does not hide empty scopes, there will be a lot of useless information. I think this is not a good idea.

actboy168 avatar Jun 01 '20 01:06 actboy168