Auto-completion in Textmate for Ruby?

浪尽此生 提交于 2019-12-07 11:22:14

问题


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.


回答1:


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




回答2:


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




回答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



来源:https://stackoverflow.com/questions/3570919/auto-completion-in-textmate-for-ruby

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!