

To change this behavior and set the parameter name before its type ( name ), go to Settings/Preferences ( ⌘+, / Ctrl+Alt+S), open the Editor | Inspections page, find the Add tag inspection in the Ruby group, and specify the desired order.


When you edit YARD tags, RubyMine checks whether or not any duplicated or wrong tags exist, and suggests that you remove any such tags.īy default, RubyMine generates the parameter name after the parameter type (for example, name). Note that with this release we have added completion for the Boolean type, it does not exist in Ruby, but it is used in YARD to represent both the TrueClass and FalseClass types. RubyMine will add the corresponding comment above the method and it will suggest that you specify the type of each parameter value.Īs you can see, the IDE completes a parameter type when we start typing String or Integer.

For example, let’s annotate the parameters of the initialize method in the Song class using do this, place the caret on the initialize method, press Alt+Enter and select add tag. Now let’s look at how RubyMine can help us to add new tags. This means you can follow the hyperlinks to view the related documentation. The Quick Documentation popup includes links to the referenced types. You can invoke this popup not only from the editor but from completion results, too. To do this, place the caret on the required object and press Ctrl+Q / F1 ( View | Quick Documentation). In this blog post, we’ll remind ourselves about the existing capabilities available in RubyMine for YARD and look at the new ones we’ve added.įirst of all, RubyMine allows you to display the documentation in a popup for methods, classes, etc. RubyMine can also utilize the YARD annotations for better code insight, it uses them to help suggest more relevant results in code completion and parameter hints for methods. RubyMine helps you to work with YARD tags and documentation in various ways, for example, you can view the documentation using Quick Documentation Lookup, create missing YARD tags, and check the validity of a YARD tag. YARD is a popular Ruby documentation generation tool that is used in multiple libraries for documenting code.
