I want to propose a built-in Text UI that's similar to GDB's TUI, which has one key feature: having multiple windows to display different information at the same time. For example:
- Variables
- Source code
- Backtrace
Also, it may be able to display debug.gem-specific output as well, like:
- Information about replay debugging
- Tracer output
And windows should support these operations:
- Focus on a certain window and scroll its content
- Configurable information
As for features like key-bindings, layout, custom color schemes...etc. They'll be nice to have but probably aren't necessary in the first few versions.
(In the long-term, I hope the UI can be close to ruby_jard's or provide APIs for community-based UIs)
Usage
By default the debugger UI shouldn't be started. But users can use it with:
tui on|off to open/close the UI.
GDB uses tui enable|disable but we already use on|off for trace and record commands.
tui focus <num> to focus on a window.
tui up|down <lines> for primitive scrolling.
- A new configuration option
RUBY_DEBUG_ACTIVATE_UI - when it's set the UI will be activated whenever a breakpoint is triggered.
Why do we need a built-in UI while there's already DAP support?
- It'll be accessible to all Ruisysts: ATM, VSCode (used by 30~40% of the Rubyists) is the only editor that can work with this debugger via DAP. This means users of other editors can't access any debugger UI powered by this project. So if there's an UI bundled with this gem, all users will be able to use it.
- It's not easy to support debugger UI for non-vscode editors atm. Because it usually requires:
- (Editor usage source: Rails survey 2020).
- It'll require zero or a minimum setup: Event if all major editors support DAP and work with this debugger, it'll still require different levels of setup + learning the editor's debugger commands to activate the debugger UI. But the built-in UI won't require any or much less of them.
When don't we let the community build it?
Although it'd be great to have a community-powered UI (or even multiple of them), there's no guarantee that someone will build one or keep maintaining one. So I think it's crucial to have one UI that's supported by the Ruby core.
Another reason is that this debugger needs to be not only thread-safe, but also ractor-safe. So anyone who builds the UI should also be well-awared of the development of Ractor and Ruby. Of course, the debugger can just provide ractor-safe APIs to the community and let the community build the UI. But to design those APIs properly it also requires at least an UI for testing.
Other notes
I want to propose a built-in Text UI that's similar to
GDB's TUI, which has one key feature: having multiple windows to display different information at the same time. For example:Also, it may be able to display
debug.gem-specific output as well, like:And windows should support these operations:
As for features like key-bindings, layout, custom color schemes...etc. They'll be nice to have but probably aren't necessary in the first few versions.
(In the long-term, I hope the UI can be close to ruby_jard's or provide APIs for community-based UIs)
Usage
By default the debugger UI shouldn't be started. But users can use it with:
tui on|offto open/close the UI.GDBusestui enable|disablebut we already useon|offfortraceandrecordcommands.tui focus <num>to focus on a window.tui up|down <lines>for primitive scrolling.RUBY_DEBUG_ACTIVATE_UI- when it's set the UI will be activated whenever a breakpoint is triggered.Why do we need a built-in UI while there's already DAP support?
When don't we let the community build it?
Although it'd be great to have a community-powered UI (or even multiple of them), there's no guarantee that someone will build one or keep maintaining one. So I think it's crucial to have one UI that's supported by the Ruby core.
Another reason is that this debugger needs to be not only thread-safe, but also ractor-safe. So anyone who builds the UI should also be well-awared of the development of Ractor and Ruby. Of course, the debugger can just provide ractor-safe APIs to the community and let the community build the UI. But to design those APIs properly it also requires at least an UI for testing.
Other notes
3.1and it's not likely to support this before that. But it'd be great to see a basic TUI in the next year.