Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Auto-completion in Textmate for Ruby?

Tags:

ruby

textmate

I'm really used to auto-completion coming from Netbeans.

In Netbeans, when I type a 'string' and then hit a 'dot' it will print out a list of methods for the String class.

TextMate doesn't seem to have that function.

Is it something you could add?

Would save A LOT of time instead of using the ri/irb/online doc all the time.

like image 755
never_had_a_name Avatar asked Aug 25 '10 23:08

never_had_a_name


3 Answers

Install the Ruby TextMate bundle, open a Ruby file and type alt+esc to get the autocompletion.

like image 198
MonsieurDart Avatar answered Nov 01 '22 16:11

MonsieurDart


You have discovered the fundamental difference between a text editor and an IDE: a text editor edits text (duh!), i.e. an unstructured stream of characters. It doesn't know anything about objects, messages, methods, mixins, modules, classes, namespaces, types, strings, arrays, hashes, numbers, literals etc. This is great, because it means that you can edit anything with a text editor, but it also means that editing any particular thing is harder than it were with a specialized editor.

A Ruby IDE edits Ruby programs, i.e. a highly structured semantic graph of objects, methods, classes etc. This is great, because the IDE knows about the rules that make up legal Ruby programs and thus will e.g. make it impossible for you to write illegal Ruby programs and it can offer you automated transformations that guarantee that if you start out with a legal Ruby program, you end up with a legal Ruby program (e.g. automated refactorings). But it also means that you can only edit Ruby programs.

In short: it's simply impossible to do what you ask with a text editor. You need an IDE. (Note: you can of course build an IDE on top of a text editor. Emacs is a good example of this. But from what I have read, the TextMate plugin API is simply not powerful enough to do this. I could be wrong, though – since I don't have a Mac, I'm mostly dependent on hearsay.)

like image 45
Jörg W Mittag Avatar answered Nov 01 '22 16:11

Jörg W Mittag


TM's "equivalent" is hitting escape, I believe. You can make escape "go across files" for completion if you use the ruby amp TM bundle http://code.google.com/p/ruby-amp/

GL. -r

like image 3
rogerdpack Avatar answered Nov 01 '22 16:11

rogerdpack