How to connect programmatically to the Ruby debugger to create a plugin for Sublime Text 2?

I want to create a plugin for Sublime Text 2 to add a Ruby debugger inside the editor. I was looking for documentation on how to connect to the debugger, but I could not find anything really good. I want to know if there is an API or if it can be connected to the debugger programmatically. I would like to use this project as a backend https://github.com/cldwalker/debugger

+5
source share
1 answer

Since Python is required to write plugins for ST2, you cannot connect to https://github.com/cldwalker/debugger/blob/master/bin/rdebug and just start learning its API to do your stuff.

But you can make popen (see http://docs.python.org/library/subprocess.html#module-subprocess ) in the debugger executable and put it as if you were doing it normally. It is not very elegant, but I am afraid that the only solution is available, since you are blocked with Python.

From there, I will probably write a python api to handle basic operations programmatically, for example, the following pseudocode:

class RubyDebugger:
  def __init__(self, debugger_path):
    # Popen stuff, consider looking for the idiomatic way of doing that :) 
    self.debugger = os.popen ...

  def breakpoint(self, file, line_number)
    self.debugger.write "breakpoint " + file + ":" + line_number
0
source

All Articles