Early Access Program Features

What’s mining: Advanced YARD support

Hello guys,

Not long ago we wrote about the coming YARD support in RubyMine, and today it’s time to share some more with you. So, what have been done since then. First, RubyMine supports any syntax of types annotations supported by YARD. More details can be found at http://yardoc.org/features.html.

You can annotate either return types or method parameters with types. Moreover you can use autocompletion for tag names, method parameters, types, anywhere you may need.  Of course complex namespaces and even alternative types are supported out of the box.

Let me show you some screenshots of all these features in action. Consider a small method with given content:

And if for some reason RubyMine hadn’t managed to compute a return type, it is pretty natural intention to add it manually. Now you can do it instantly.

You even get the autocompletion here.

Using intention actions you can create type annotations for any method parameter as well. But once you’ve made a mistake in parameter name or want to rename it for any other reason you get annotation renamed automatically. On the screenshot below you can see the familiar in-place rename for parameters and local variables.

All the tags are validated on the fly for duplications, wrong parameter names, etc., with quickfixes available.

That’s all about YARD support within the editor, however we have yet another feature related to YARD to share. As you know http://rubydoc.info uses YARD inside it to provide the information about classes, modules, methods, etc., and RubyMine uses this resource to show external documentation for almost everything, just navigate to the item and use either action View | External Documentation or a corresponding shortcut.

P.S. The last thing to mention is that parameter descriptions are show within Quick Documentation Popup.

Thanks for reading and stay tuned!

Develop with pleasure!
-JetBrains RubyMine Team

Discover more