Gui*_*oMB 5 ruby debugging ruby-on-rails sublimetext2
我想为Sublime Text 2开发一个插件,在编辑器中添加一个Ruby调试器.我正在寻找一些关于如何连接到调试器的文档,但我找不到任何真正好的文档.我想知道是否有API或者是否可以以编程方式连接到调试器.我想将此项目用作调试器后端https://github.com/cldwalker/debugger
由于需要使用 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
Run Code Online (Sandbox Code Playgroud)