Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Sublime Text have support for Ruby API (auto-complete)?

How can I get the list of methods that are available for some object or class, like this:

Netbeans auto-complete

Does Sublime Text have this feature for Ruby? just like this https://github.com/BoundInCode/Display-Functions , but for Ruby

NOTE: i don't talk about tab complete, what i want for example if i typed "Array." then a list of the Array class methods ruby-doc.org/core-1.9.3/Array.html show up in a list, just like in netbeans with java or in eclipse

like image 459
Marwan Avatar asked Jun 19 '13 22:06

Marwan


People also ask

Does Sublime Text have autocomplete?

Usage. By default, Sublime Text will automatically show the completions popup when a user is editing source code or markup, but not within prose in comments, strings or markups. Pressing the Esc key will hide the completions popup. To manually show the completions popup, press Ctrl+Space.

Can I use Sublime Text for Ruby?

Setting Sublime for RubyTo set sublime, we have to open preferences menu, now Syntax Specific user configuration. Now on selecting this option Sublime Text will take your currently active file's code syntax and create a config file specific to it (e.g. ruby. sublime-settings).

How do I turn off autocomplete in sublime?

So, to disable Python syntax autocomplete: open the command palette with ctrl + shift + P. enter Package Control: Remove Package and select it. enter Jedi and remove the Jedi autocomplete package.


1 Answers

Sublime Text 2 has some degree of auto-complete functionality right out of the box. If you want to kick it up a notch, the Sublime CodeIntel plugin is probably the closest thing to intelli-sense that we have for Sublime Text w/ Ruby, supporting:

  • 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.

Auto-complete:

sample auto-complete / intelli-sense


Symbol definition:

sample symbol definition

Would output the following to the status bar:

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.


If you run into install/usage issues:

At the time of posting this answer, I couldn't get the tool-tips to work and the auto-complete doesn't support external gems, and I also had some issues with installing via package installer. If you run into issues installing try manually cloning the repo into your packages folder. For me this was located at ~/.config/sublime-text-2/Packages/.

If you successfully install and are still having issues getting it running at that point, try re-building as mentioned in the plugin's read-me. Also check out the fix mentioned here:

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

like image 113
Noz Avatar answered Oct 18 '22 14:10

Noz