Skip to content
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

Hint debugger command in irb:rdbg session #768

Merged
merged 1 commit into from
Nov 23, 2023
Merged

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Nov 18, 2023

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.

@st0012 st0012 added the enhancement New feature or request label Nov 18, 2023
@st0012 st0012 force-pushed the hint-debugger-command branch from ea43ad9 to 1b49f87 Compare November 19, 2023 00:03
lib/irb/debug.rb Outdated Show resolved Hide resolved
lib/irb/debug.rb Outdated Show resolved Hide resolved
@st0012 st0012 force-pushed the hint-debugger-command branch 3 times, most recently from 5a6e72e to f8e5820 Compare November 19, 2023 08:04
@st0012
Copy link
Member Author

st0012 commented Nov 19, 2023

Good catch on both. I've updated 👍

@st0012 st0012 requested a review from tompng November 19, 2023 08:05
lib/irb/debug.rb Outdated Show resolved Hide resolved
@st0012 st0012 force-pushed the hint-debugger-command branch from f8e5820 to c0eb8fd Compare November 20, 2023 16:41
@st0012 st0012 requested a review from tompng November 20, 2023 16:45
@st0012 st0012 self-assigned this Nov 20, 2023
@st0012 st0012 force-pushed the hint-debugger-command branch from c0eb8fd to bc3109b Compare November 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 st0012 force-pushed the hint-debugger-command branch from bc3109b to d1d84ed Compare November 22, 2023 23:32
@tompng tompng merged commit fdf24de into master Nov 23, 2023
47 checks passed
@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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants