5

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.

never_had_a_name
  • 90,630
  • 105
  • 267
  • 383
  • I came from the same kind of environment and I prefer the lack of auto-completion now. I feel I understand the language and available features alot better. – fletcher Aug 25 '10 at 23:12
  • But unfortunately, a missing feature is not a feature, and when you try to jump forth and back between classes in API:s you want to study, it's not very efficient to not even have jump to built in into the classes and methods. – never_had_a_name Aug 25 '10 at 23:14
  • In TextMate similar features often come with a bundle, i.e. commands which look up some API documentation when invoked. Sadly, the particular feature you request is not available through the bundle-enhancements. Because you are not interested in API documentation, you are interested in methods for this certain object which starts with whatever you typed. Since I learned ruby with a text-editor I feel comfortable to switch to an (always opened) IRB and test my idea first. Are there lightweight IDEs available which come with this particular feature? Would be nice to know, thanks. :) – Florian Pilz Jan 06 '11 at 13:45
  • Similar question: http://stackoverflow.com/questions/3244982/how-to-dot-method-in-textmate In short: The FAQ of TextMate tells you, that this feature is not supported. – Florian Pilz Jan 06 '11 at 14:15
  • The nearest you can come to this feature is Option-Esc. This will bring up a list of completions Esc would offer you stepwise. It's still not the feature you asked for. I found this answer in the related question http://stackoverflow.com/questions/2556391/textmate-code-completion-question/ – Florian Pilz Jan 09 '11 at 07:25

3 Answers3

8

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

MonsieurDart
  • 6,005
  • 2
  • 43
  • 45
3

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

Jörg W Mittag
  • 363,080
  • 75
  • 446
  • 653
  • Although I completely agree with you, I would append that while we are talking about “autocompletion on dot” feature, even the world-worst plugin API is sufficient to perform the task for ruby. In case of ruby we don’t need “a highly structured semantic graph of objects, methods, classes etc”, since nothing may prevent API from background-call to `[public_]instance_methods` to show the result in the drop-down list. – Aleksei Matiushkin Feb 16 '13 at 05:45
  • @mudasobwa that's not actually going to get you a complete list of the autocomplete context in all cases. Ruby is actually incredibly complex behind the scenes. Would that it were simpler! – Julian Leviston Jul 29 '14 at 03:36
3

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

rogerdpack
  • 62,887
  • 36
  • 269
  • 388