actboy168 / lua-debug

Lua Debug Adapter for Visual Studio Code
MIT License
439 stars 95 forks source link

Automatically expand variable scope tabs #94

Open moon6969 opened 4 years ago

moon6969 commented 4 years ago

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.

actboy168 commented 4 years ago

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.

moon6969 commented 4 years ago

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 👍

actboy168 commented 4 years ago

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.