ruby - Sublime Text 是否支持 Ruby API(自动完成)?

标签 ruby autocomplete sublimetext2 sublimetext

如何获取可用于某些对象或类的方法列表,如下所示:

Netbeans auto-complete

Sublime Text 有 Ruby 的这个功能吗? 就像这样https://github.com/BoundInCode/Display-Functions , 但对于 Ruby

注意:我不谈论制表符完成,例如如果我键入“Array”我想要什么。然后 Array 类方法列表 ruby​​-doc.org/core-1.9.3/Array.html 显示在列表中,就像在 netbeans 中使用 java 或在 eclipse 中一样

最佳答案

Sublime Text 2 具有一定程度的开箱即用的自动完成功能。如果你想提高一个档次,Sublime CodeIntel插件可能是我们为带有 Ruby 的 Sublime Text 提供的最接近智能感知的东西,支持:

  • Jump to Symbol Definition - Jump to the file and line of the definition of a symbol.
  • Imports autocomplete - Shows autocomplete with the available modules/symbols in real time.
  • Function Call tooltips - Displays information in the status bar about the working function.

自动完成:

sample auto-complete / intelli-sense


符号定义:

sample symbol definition

将以下内容输出到状态栏:

Info: Passes each element of the collection to the given block. The method returns true if the block ever returns a value other than false or nil. If the block is not given, Ruby adds an implicit block of { |obj| obj } that will cause any? to return true if at least one of the collection members is not false or nil.


如果您遇到安装/使用问题:

在发布此答案时,我无法使用工具提示,并且自动完成功能不支持外部 gem,而且我在通过软件包安装程序进行安装时也遇到了一些问题。如果您在安装时遇到问题,请尝试手动将存储库克隆到您的包文件夹中。对我来说,它位于 ~/.config/sublime-text-2/Packages/

如果您成功安装但此时仍然无法运行,请尝试按照插件的自述文件中所述重新构建。另请查看此处提到的修复:

https://github.com/SublimeCodeIntel/SublimeCodeIntel/issues/249#issuecomment-19763941

关于ruby - Sublime Text 是否支持 Ruby API(自动完成)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17202579/

相关文章:

ruby-on-rails - 如何根据用户当前时区制作今天的日期方法?

php - 如何在自动完成表单的脚本中获取 json 文件的多个值

string - 使用 Sublime Text 在特定字符串后删除/添加换行符

sublimetext2 - Sublime Text 2中有什么方法可以进行项目特定的软件包设置吗?

ruby - 使用 Vagrant 设置集群模式 Docker Swarm

ruby-on-rails - object.count 返回 0。但是 object.any?返回真。发生了什么?

ios - 使用 Swift 在 Apple iOS 开发中实现多标签自动完成文本字段

jquery - 如何获得两列 jquery 自动完成?

java - Sublime Text 2 在 Java 开发方面胜过 Eclipse

ruby-on-rails - 如何为这个公共(public)方法编写规范(使用 RSpec)?