tags:

views:

281

answers:

3

Is there a way to make emacs pull autocompletions of ruby methods the way Eclipse and NetBeans do? That is if I type File. and press CTRL-space in Eclipse I will get a list of File methods. Same with variables. I have installed autocomplete plugin, ruby-mode, rinari and cedet, but so far it will complete local variable and method names, but will not native ones.

+1  A: 

I'm not familiar with ruby, but if by "native methods" you mean stuff in some system library, there are a couple options for extending CEDET to do the work.

If there are ruby files somewhere that have all that code in them, and if ruby supports some sort of "include" or "import" statement, then you need to add that location to the include path for ruby. This probably requires a change the the ruby source code to add a new system include path. You can see examples in semantic-c.el. You may also need to override the function semantic-tag-include-filename to convert the include into a findable filename.

If there are no includes, and there is just some ruby interpreter that knows all this stuff, then you will instead need to code up a full ruby "omniscient" database, similar to semanticdb-el.el. It will need a way to query ruby for various things and return them as answers.

Any such enhancements would be welcome back in the ruby support in CEDET's contrib area.

Eric
I am too new to both emacs and ruby to write something like this. I was hoping for a pre-made solution.
Mad Wombat
A: 

I think you need something like RSense. You might also like the more general auto complete mode.

Bozhidar Batsov
I have the autocomplete installed, but it doesn't seem to have any way to do ruby completions the way I want. I will take a look at RSense.
Mad Wombat
A: 

Ruby is an interpreted language, making it difficult to do certain things, such as autocompletion. How would you know what the object type is, if it's not defined? Therefore, premade solutions are limited or nonexistent. Even the autocompletion in Netbean/Eclipse will only work on class methods (if I'm not mistaken).

Pran