Adding custom stubs to project?
We embed a Ruby interpreter into our application. When the application starts the Ruby environment have access to the Ruby environment we ship as well as our Ruby API.
I'm trying to figure out how to make the auto-complete work with this. I have a folder of stubs, but RubyMine doesn't offer auto-complete unless I require the stub file.
I added the stub folder to the project. I also tried to set it as Load Path. But RubyMine doesn't seem to offer the classes, modules, methods in autocomplete automatically.
Any suggestions on how this can be done?
Please sign in to leave a comment.
Hello, Thomas,
could you please provide more details about your project structure. Do you have a specific Ruby SDK or gems that you want to be used for autocompletion in your project?
Hi Olga.
I work for Trimble SketchUp, and we have an extensive Ruby API that let the user interact with our application: http://ruby.sketchup.com/
We embed a Ruby interpreter into our application which let users write extension to our application using Ruby. So we are not in a normal server environment where you normally use Ruby. Nor does the gem system work well in our environment.
Our API is immediatly availible for our Ruby extension developers - when their extensions load. So there is no files for them to require. So you can consider our API an extension to the Ruby core for our extension evironment.
I'm currently looking into creating RubyMine project where one can get intellisense and auto-complete for API.
So far, when I add the folder with out stubs RubyMine will stop putting little squiggled lines under our API objects (classes/modules etc). But it won't offer autocompletion.
One of my sub files is called "edge.rb" - and if I add a `require "edge.rb"` in the file I'm working in for my project, then I will get autocomplete for the Sketchup::Edge class that the stub contains. But I can't get it to work without - which is where I'm stomped.
Hi, Thomas,
thank you for the details, I've submitted the corresponding feature request on our tracker (https://youtrack.jetbrains.com/issue/RUBY-18827 ), so it would be great if you could vote for it, in this case developers will be able to ask you questions if they have any.
So it's currently not possible to make RubyMine aware of third-party stubs like this? No way to re-use the mechanism that RubyMine use for the Ruby core objects?
Unfortunately at the moment it's not possible so please vote for this feature.
For PhpStorm there is a Laravel IDE Helper plugin that provide custom code insight and auto complete; https://github.com/barryvdh/laravel-ide-helper
It appear to simply add a _ide_helper.php in the root of the project. How does that work? Is there something in the plugin that makes PhpStorm parse it? Or does PhpStorm automatically pick it up? Any similar method in RubyMine?
I just came across a post I'd made in 2014 which I'd completely forgotten about; https://intellij-support.jetbrains.com/hc/en-us/requests/376248
One of the suggestions there was to package the stubs up as a gem. I just tried that and that seemed to work well.