What’s mining: Advanced YARD support
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
Subscribe to Blog updates
Thanks, we've got you!
The RubyMine 2023.3 Early Access Program Is Open!
Hello everyone, The third RubyMine Early Access Program of 2023 is underway! The key change in the first EAP build is an important indexing optimization. By refactoring our code base, we’ve doubled RubyMine’s indexing speed compared to v2023.1. This is particularly noticeable when working wi…
Performance Improvements in RubyMine 2023.1
Hello everybody, The new release is fast approaching, so it’s time to unveil the performance enhancements you can expect from RubyMine 2023.1. Faster code completion When developing and supporting RubyMine, we analyze a great load of anonymized usage data. A lot of recent data pointed to the fact t…
RubyMine 2023.1 EAP5 Is Out!
Hello everyone, RubyMine 2023.1 EAP5 is now available! Below you can find the most notable features in this build. We encourage you to try them out and share your feedback in the comments or in our issue tracker. Migration of Ruby code to the Symbol API In order to improve code insight actions such…
The RubyMine 2023.1 EAP2 Is Out!
The RubyMine 2023.1 Early Access Program recently started and EAP2 is already here! You can get the new build from our website or via the free Toolbox App. In this post, we’ll highlight some of the most important updates included in the new EAP version. Rails 7: support for turbo-rails complet…