有没有办法在 Sublime Text 2 中验证保存时的 ruby 语法?
有谁知道有一个插件可以做到这一点?在 TextMate 中很容易找到,但到目前为止 Sublime 2(我更喜欢它)还没有找到。
Does anyone know of a plugin that does this? It was pretty easy to find in TextMate, but so far no luck for Sublime 2 (which I much prefer).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
尝试 SublimeLinter 。我将它用于 Python,但它也支持 Ruby。
Try SublimeLinter . I'm using it for Python, but it supports Ruby too.
验证 Ruby 语法(尽管它不是其核心功能)的 Sublime Text 2 插件是 RubyTest ,使用
Alt-Shift-V
键盘快捷键。A Sublime Text 2 plugin which validates Ruby syntax (though it's not its core feature) is RubyTest, with the
Alt-Shift-V
keyboard shortcut.我没有使用过 TextMate,所以我不确定他们是如何实现它的,但是你可以为 sublime text 2 编写一个插件来实现这一点。在 Sublime Text 2 中编写插件非常容易,并且该网站有一些很好的文档。
然而,我使用 Guard ( https://github.com/guard/guard ) 并让它触发事件当保存文件时。通常我使用 rspec、cucumber 或两者,并让它针对该特定文件运行测试,您可以让它运行“ruby -c your_file.rb”来检查语法。这样做的好处是您可以让它设置咆哮通知。
然而,听起来插件确实是你最好的选择。
大卫
I've not used TextMate so I'm not sure how they accomplish it however you could either write a plugin for sublime text 2 to accomplish this. It's pretty easy to write a plugin in Sublime Text 2 and the site has some good documentation.
I however use Guard ( https://github.com/guard/guard ) and have it fire off events when a file is saved. Usually I'm using rspec, cucumber or both and have it run the tests against that specific file, you could have it run "ruby -c your_file.rb" which checks the syntax. Good benefit of this is you can have it setup growl notifications.
It does sound like a plugin is your best bet however.
David
我为 Sublime Text 2 创建了一个简单的 RubyCheckOnSave 插件,该插件会检查 ruby 文件的语法。已保存。
尝试让我知道
I created a simple RubyCheckOnSave plugin for Sublime Text 2, the plugin checks the syntax of ruby files when they're saved.
Try and let me know