Skip to content

Hint debugger command in irb:rdbg session - #768

Merged
tompng merged 1 commit into
masterfrom
hint-debugger-command
Nov 23, 2023
Merged

Hint debugger command in irb:rdbg session#768
tompng merged 1 commit into
masterfrom
hint-debugger-command

Conversation

@st0012

Copy link
Copy Markdown
Member

Background

In ruby/debug#1024 (comment), @ko1 raised the concern that users may accidentally hit debug commands when trying to evaluate variables with certain names. I then talked to a few IRB users during RubyConf and some of them confirmed that this did happen to them before. So I think we should explore methods to avoid such confusion.

Description

When user enters irb:rdbg session, they don't get the same hint that the debug gem provides, like

(rdbg) n # next command

This means that users may accidentally execute commands when they want to retrieve the value of a variable.

So this commit adds a Reline output modifier to add a simiar hint:

irb:rdbg(main):002> n # debug command

It is not exactly the same as debug's because in this case the importance is to help users distinguish between value evaluation and debugger command execution.

@st0012st0012 added the enhancement New feature or request label Nov 18, 2023
@st0012
st0012force-pushed the hint-debugger-command branch from ea43ad9 to 1b49f87CompareNovember 19, 2023 00:03
@st0012st0012 mentioned this pull request Nov 19, 2023
Comment threadlib/irb/debug.rb Outdated
Comment threadlib/irb/debug.rb Outdated
@st0012
st0012force-pushed the hint-debugger-command branch 3 times, most recently from 5a6e72e to f8e5820CompareNovember 19, 2023 08:04
@st0012

Copy link
Copy Markdown
MemberAuthor

Good catch on both. I've updated 👍

@st0012
st0012 requested a review from tompngNovember 19, 2023 08:05
Comment threadlib/irb/debug.rb Outdated
Comment threadlib/irb/debug.rb
@st0012
st0012force-pushed the hint-debugger-command branch from f8e5820 to c0eb8fdCompareNovember 20, 2023 16:41
@st0012
st0012 requested a review from tompngNovember 20, 2023 16:45
@st0012st0012 self-assigned this Nov 20, 2023
@st0012
st0012force-pushed the hint-debugger-command branch from c0eb8fd to bc3109bCompareNovember 22, 2023 23:31
When user enters irb:rdbg session, they don't get the same hint that the
`debug` gem provides, like
```
(rdbg) n # next command
```
This means that users may accidentally execute commands when they want to
retrieve the value of a variable.
So this commit adds a Reline output modifier to add a simiar hint:
```
irb:rdbg(main):002> n # debug command
```
It is not exactly the same as `debug`'s because in this case the importance
is to help users distinguish between value evaluation and debugger command
execution.
@st0012
st0012force-pushed the hint-debugger-command branch from bc3109b to d1d84edCompareNovember 22, 2023 23:32
@tompng
tompng merged commit fdf24de into masterNov 23, 2023
@tompng
tompng deleted the hint-debugger-command branch November 23, 2023 07:29
matzbot pushed a commit to ruby/ruby that referenced this pull request Nov 23, 2023
(ruby/irb#768)
When user enters irb:rdbg session, they don't get the same hint that the
`debug` gem provides, like
```
(rdbg) n # next command
```
This means that users may accidentally execute commands when they want to
retrieve the value of a variable.
So this commit adds a Reline output modifier to add a simiar hint:
```
irb:rdbg(main):002> n # debug command
```
It is not exactly the same as `debug`'s because in this case the importance
is to help users distinguish between value evaluation and debugger command
execution.
ruby/irb@fdf24de851
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancementNew feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@st0012@tompng