8000 Add `show_src_lines_frame` option by HeyNonster · Pull Request #1138 · ruby/debug · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add show_src_lines_frame option #1138

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HeyNonster
Copy link
@HeyNonster HeyNonster commented May 5, 2025

This addresses the feedback from #1094 and resolves #1135.

Description

Both up and down only show 1 source line when called, I think it would be more useful if there was a configurable way to provide more context.

This adds a show_src_lines_frame (happy to rename this) configuration option (which defaults to 1) that determines how many source lines get shown for frame operations up, down, and set (frame).

I think the lib/debug/config.rb changes are easier to review without whitespace:

git diff -w lib/debug/config.rb
diff --git a/lib/debug/config.rb b/lib/debug/config.rb
--- a/lib/debug/config.rb
+++ b/lib/debug/config.rb
@@ -14,6 +14,7 @@ module DEBUGGER__
     # UI setting
     log_level:           ['RUBY_DEBUG_LOG_LEVEL',      "UI: Log level same as Logger",               :loglevel, "WARN"],
     show_src_lines:      ['RUBY_DEBUG_SHOW_SRC_LINES', "UI: Show n lines source code on breakpoint", :int, "10"],
+    show_src_lines_frame:['RUBY_DEBUG_SHOW_SRC_LINES_FRAME', "UI: Show n lines source code on frame operations", :int, "1"],
     show_evaledsrc:      ['RUBY_DEBUG_SHOW_EVALEDSRC', "UI: Show actually evaluated source",         :bool, "false"],
     show_frames:         ['RUBY_DEBUG_SHOW_FRAMES',    "UI: Show n frames on breakpoint",            :int, "2"],
     use_short_path:      ['RUBY_DEBUG_USE_SHORT_PATH', "UI: Show shorten PATH (like $(Gem)/foo.rb)", :bool, "false"],

Also probably useful to note that byebug displays more lines by default making it quite a difference switching from byebug to debug:

byebug-vs-debug.mov

@HeyNonster HeyNonster force-pushed the nony--show-src-lines-frame-operations branch from 361ce27 to 30b69a8 Compare May 5, 2025 15:39
@HeyNonster
Copy link
Author

@ko1, please let me know if you would like me to change the name of the configuration!

Both `up` and `down` only show 1 source line when called, I think it
would be more useful if there was a configurable way to provide more
context.

This adds a `show_src_lines_frame` configuration option (which defaults
to `1`) that determines how many source lines get shown for frame operations `up`, `down`, and `set` (frame).
@HeyNonster HeyNonster force-pushed the nony--show-src-lines-frame-operations branch from 30b69a8 to d3d3dd4 Compare May 8, 2025 08:56
@HeyNonster
Copy link
Author

Closes #1135.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

debug does not show context when navigating up & down stack
1 participant
0