5

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

4

1 回答 1

0

由于需要 Python 为 ST2 编写插件,因此您无法连接到https://github.com/cldwalker/debugger/blob/master/bin/rdebug并开始研究它的 API 来完成您的工作。

但是您可以在调试器可执行文件上执行 popen(请参阅http://docs.python.org/library/subprocess.html#module-subprocess)并像平常一样驱动它。这不是很优雅,但恐怕这是唯一可用的解决方案,因为你被 Python 锁定了。

从那里,我可能会编写一些 python api 以编程方式处理基本操作,如以下伪代码:

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
于 2012-10-04T13:54:56.747 回答