Adding an API, for auto completion ?

Hi,
I'm having a small problem, which, if unsolved won't be a big deal. Anyway, i'm using an api embedded in a program, with the ruby interpreter, and i'm using rubymine to work on my scripts. Sadly as no require are involved in the process, I can't use the auto completion for that api. I was wondering if there were any possible way for me to create some sort of plugin to add the auto completion for that api?

I used to develop with Komodo, and it was very easy to do that ( create a xml like file, with the methods, parameters, description etc.. and place it in the right folder ).
So it would be quite cool if I could do the same thing for rubymine.

Thanks.

7 comments
Comment actions Permalink

Hello Marc,

I'm having a small problem, which, if unsolved won't be a big deal. Anyway, i'm using an api embedded in a program, with the ruby interpreter, and i'm using rubymine to work on my scripts. Sadly as no require are involved in the process, I can't use the auto completion for that api. I was wondering if there were any possible way for me to create some sort of plugin to add the auto completion for that api?


I used to develop with Komodo, and it was very easy to do that ( create a xml like file, with the methods, parameters, description etc.. and place it in the right folder ).
So it would be quite cool if I could do the same thing for rubymine.

Could you please clarify a bit?
What kind of functionality do you want to have? Do you want to have some classes to be visible in autocompletion etc on the top level or something more complex?
We have plans to provide some API in Ruby for extending RubyMine using Ruby scripts but at first we want to know your goals.

Regards,
Oleg

0
Comment actions Permalink

hum Mostly just auto completion on top level. pretty much like with the standard classes, accessible from every script, without using require/load.

Here is the file i used in komodo, to describe the api, and enable the auto completion for it, to see "how simple" it can be, i did it mostly just for me and didn't fill all the possible attribute ( like doc or parameters )

http://rmxp.trebor777.net/rmvx/rgss2.cix (don't worry it's just an xml file with a weird extension)


It's a small api only used in a software called RPG Maker XP ( and the last version VX ) that allows some ruby scripting and provide an api to create 2D games very simply, and the api and the ruby interpreter are embedded in a .exe & a dll. It just happens that the provided script editor, is very very basic, ( no code completion, nor syntax debugging, just syntax coloring ). So I decided to use Rubymine to develop my scripts for it, in order to be more productive.
I said no require are involved because the api is inside the .dll with the ruby interpreter. and then loads the user made scripts, and that the "require "rgss" " wouldn't serve any purpose and simply crashes.

Hope it's clearer for you.

0
Comment actions Permalink

hum Mostly just auto completion on top level. pretty much like with the rails classes, accessible from every script, without using require/load.


Here is the file i used in komodo, to describe the api, and enable the auto completion for it, to see "how simple" it can be, i did it mostly just for me and didn't fill all the possible attribute ( like doc or parameters )


http://rmxp.trebor777.net/rmvx/rgss2.cix (don't worry it's just an xml file with a weird extension)


It's a small api only used in a software called RPG Maker XP ( and the last version VX ) that allows some ruby scripting and provide an api to create 2D games very simply, and the api and the ruby interpreter are embedded in a .exe & a dll. It just happens that the provided script editor, is very very basic, ( no code completion, nor syntax debugging, just syntax coloring ). So I decided to use Rubymine to develop my scripts for it, in order to be more productive.
I said no require are involved because the api is inside the .dll with the ruby interpreter. and then loads the user made scripts, and that the "require "rgss" " wouldn't serve any purpose and simply crashes.


Hope it's clearer for you.

Thanks a lot for this example, sound pretty reasonable. I suppose we can add similar functionality to RubyMine. I think it will be more in ruby-style to define such a APIs in YAML format.
I've filled an issue: http://www.jetbrains.net/jira/browse/RUBY-4344
Please vote for it and watch to get notification when it's implemented.

Regards,
Oleg

0
Comment actions Permalink

Oh great!! Thanks a lot!
I hope a lot it'll be made!^^ ( just voted for it)

YAML sounds good to me:p easier to read

0
Comment actions Permalink

Hello Marc,

I hope a lot it'll be made!^^ ( just voted for it)


YAML sounds good to me:p easier to read :p

I've googled a bit for cix files spec and couldn't find any description of it, could you please explain some details of file you've attached?

<scope name="rgss2" lang="Ruby" ilk="blob">
          <scope name="load_data" ilk="function" />
          <scope name="save_data" ilk="function" />
          <scope name="Bitmap" classrefs="Object" ilk="class">
                <scope name="new" attributes="__classmethod__ __ctor__" ilk="function" />
               <scope name="dispose" doc="Frees the bitmap. If the bitmap has already been freed, does nothing." ilk="function" />
               <scope name="disposed?" ilk="function" />



 

What does classrefs="Object" mean?
And what about scope name="rgss2" lang="Ruby" ilk="blob" ?

Thanks in advance,
Oleg

0
Comment actions Permalink

scope name="rgss2" lang="Ruby" ilk="blob" defines for what language this is for ( as komodo is a multi language ide) and the name of the api  , In our case we only need the name of the api,  I don't know what ilk is for, and it didn't seemed to affect anything in komodo for that kind of element.

classrefs is the SuperClass

if you think of a better description to do in the yaml file, please feel free to do so
When I did this cix, I've looked how they did the rails one, and used it as a reference, It seems that cix are generated files with some sort of script.
Oh good news, i've found a Cix description file, in my komodo install Look in the attachement.  Hope it helps

Edit : Here is the rails cix file, much more complete than mine.



Attachment(s):
cix-2.0.txt
rails.cix
0
Comment actions Permalink

Hello guys,

New RubyMine EAP build will include RubyMine Extensions manager to allow users enable their own scripts extending RubyMine functionality.
Full API documentation coming soon. As for now you can look at: http://www.jetbrains.net/devnet/thread/282641?tstart=30

Regards,
Oleg

0

Please sign in to leave a comment.