RubyMine 2017.2 Help

Documenting Source Code in RubyMine

Basics

RubyMine provides convenient features for creating documentation comments.

Documentation comments in your source code are available for the Quick Documentation Lookup and open for review on pressing Ctrl+Q.

Documentation comments can be created in accordance with the RDoc or YARD syntax.

When you create additional tags, RubyMine provides code completion that suggests the possible tag names.

RDoc support

RDoc tags are completed:

/help/img/idea/2017.2/rm_doc_comment_tags.png

RDoc highlighting in documentation comments can be enabled or disabled. To enable it, select the check box Highlight RDoc and ruby syntax in comments in the Appearance page of the editor settings.

YARD support

YARD tags are completed:

/help/img/idea/2017.2/rm_doc_comment_tags_yard.png
  • YARD directives complete in places where methods could be defined;
  • Type annotations complete where applicable (assignments, before block vars);
  • param/return/etc. tags complete before methods, inside directive docstrings, before attr_reader/writer/accessor

HEREDOC support

Besides documentation comments in the RDoc and YARD formats, RubyMine supports HEREDOCS. This is especially useful, if you are writing large blocks of text.

For example, consider the following:

/help/img/idea/2017.2/rm_heredoc.png

If you perform run, the lines between <<-HEREDOC and HEREDOC appear in the Run tool window.

Last modified: 26 October 2017

See Also