ruby / debug

Debugging functionality for Ruby
BSD 2-Clause "Simplified" License
1.12k stars 124 forks source link

Can't execute multiple line statement #1033

Closed obregonia1 closed 9 months ago

obregonia1 commented 10 months ago

I can't execute like below code.

(ruby) 3.times do |i|
eval error: (rdbg)/test.rb:1: syntax error, unexpected end-of-input
3.times do |i|
              ^

But, this works.

(ruby) 3.times do |i|;i *= 10; p i;end
0
10
20
3

I created this issue because it worked in irb and I thought this behavior was useful.

maxp-hover commented 9 months ago

This is a serious shortcoming of the tool. Seconding that the tool would vastly benefit from this

st0012 commented 9 months ago

With version 1.9.0 it now supports using IRB as the console, which supports multi-line input (among other features). You can activate it by setting env var: RUBY_DEBUG_IRB_CONSOLE=1.

obregonia1 commented 9 months ago

@st0012 Thanks!! This issue has resolved.