shuky19 / sublime_debugger

Interactive debugger for sublime
Apache License 2.0
429 stars 24 forks source link

"IndexError: list index out of range" when attempting to run Ruby using debugger #37

Open JohnAtFenestra opened 10 years ago

JohnAtFenestra commented 10 years ago

I have recently started evaluating Sublime Text for some work we are doing in Ruby. I installed the sublime_debugger and when executing a test program (see below), I get an error in the console. "IndexError: list index out of range".

I should note that I am running a version of Ruby (2.1.2) which is technically unsupported by Sublime Text Debugger, however, the full minor (2.1.0) appears to be supported according to the contents of Ruby Debugger.sublime-settings. In order to allow 2.1.2 to be used I changed the following line in Ruby Debugger.sublime-settings

  // Which ruby version are supported, by default listed here are the versions
  // we already have checked.
  // 2.1.2 Added Oct 22 by jee
  "supported_ruby_versions": ["2.1.2","2.1.0", "2.0.0", "1.9.3"],

Here are my specs:

Item Version
OS Ubuntu 12.04.5 LTS
Sublime Text 2.0.2.2221
Ruby ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-linux]
Python 2.7.3
Sublime Debugger https://github.com/shuky19/sublime_debugger/commit/2f0ef5f56124540de26c4187628e0d0658a301da

Gems

bigdecimal (1.2.4)
bundler (1.6.2)
bundler-unload (1.0.2)
byebug (3.5.1)
clipboard (1.0.5)
coderay (1.1.0)
columnize (0.8.9)
debugger-linecache (1.2.0)
debugger-ruby_core_source (1.3.5)
diff-lcs (1.2.5)
executable-hooks (1.3.2)
gem-wrappers (1.2.4)
io-console (0.4.2)
json (1.8.1)
method_source (0.8.2)
mini_portile (0.6.0)
minitest (4.7.5)
monads (0.0.1)
nokogiri (1.6.3.1)
pry (0.10.1)
pry-byebug (2.0.0)
psych (2.0.5)
rake (10.1.0)
rdoc (4.1.0)
rspec (3.0.0)
rspec-core (3.0.4)
rspec-expectations (3.0.4)
rspec-mocks (3.0.4)
rspec-support (3.0.4)
rubygems-bundler (1.4.4)
rvm (1.11.3.9)
slop (3.6.0)
test-unit (2.1.2.0)
uri_template (0.7.0)

Test program being used:

TestMe = Struct.new(:value) do
    def repeat
        [value, value, value].join('/')
    end
end

puts "Hello World"

t = TestMe.new('hello')

puts t.repeat
puts t.repeat

Full call stack from console:

Traceback (most recent call last):
  File ".\threading.py", line 532, in __bootstrap_inner
  File ".\threading.py", line 484, in run
  File "./debug_command.py", line 92, in <lambda>
    SublimeHelper.set_timeout_async(lambda file_path=file_path,bundle=use_bundler, args=arguments: self.start_command_async(file_path, bundle, *args), 0)
  File "./debug_command.py", line 105, in start_command_async
    self.debugger.run_command(DebuggerModel.COMMAND_START, PathHelper.get_pwd(file_path), file_path, *args)
  File "./debugger/ruby_imp/ruby_debugger.py", line 47, in run_command
    RubyDebugger.COMMANDS[command_type].execute(self.connector, *args)
  File "./debugger/ruby_imp/ruby_custom_debug_command.py", line 10, in execute
    self.lambda_command(debugger_constroller, *args)
  File "./debugger/ruby_imp/ruby_debugger.py", line 25, in <lambda>
    DebuggerModel.COMMAND_START:RubyCustomDebugCommand(lambda debugger_constroller, *args: debugger_constroller.start(*args)),
  File "./debugger/ruby_imp/ruby_debugger_connector.py", line 47, in start
    self.start_process(current_directory, file_name, args)
  File "./debugger/ruby_imp/ruby_debugger_connector.py", line 106, in start_process
    directory = " '-C"+sublime.active_window().folders()[0]+"'"
IndexError: list index out of range

Value of variables extracted by adding print statements:

    def start_command(self, file_name, use_bundler=False):
        is_legal, file_path, arguments = PathHelper.get_file(file_name, self.window)
        print 'file_name={0}'.format(file_name)
        print 'file_path={0}'.format(file_path)
        print 'use_bundler={0}'.format(use_bundler)
...
file_name=/home/john/Documents/development/ruby-monads/sandbox2.rb
file_path=/home/john/Documents/development/ruby-monads/sandbox2.rb
use_bundler=False

Do you have any suggestions for resolving this issue? Do you require any further information or tests on my part?

darkgem666 commented 9 years ago

Hi, i know this comes a year later, but did you ever resolve this issue?, i have this problem right now.

thanks