RubyMine 6.3.0 Web Help

In this section:

To create documentation comments for a Ruby method
  1. Place the caret before the declaration of the method you want to document.
  2. Press Ctrl+Slash or Ctrl+NumPad /Ctrl+Slash or Ctrl+NumPad /Ctrl+Slash or Ctrl+NumPad /Ctrl+Slash or Ctrl+NumPad /Alt+SemicolonCtrl+Slash, Ctrl+NumPad / or Ctrl+ColonCtrl+Slash, Ctrl+NumPad / or Ctrl+Shift+CCtrl+Slash or Ctrl+NumPad /Meta+Slash or Meta+NumPad /Command Slash or Command NumPad /Command Slash or Command NumPad /Command Slash or Command NumPad /Command Slash or Command NumPad /
  3. Press Ctrl+SpaceCtrl+SpaceCtrl+SpaceCtrl+SpaceAlt+SlashCtrl+SpaceCtrl+Space or Ctrl+Back SlashCtrl+SpaceCtrl+SpaceControl SpaceControl SpaceControl SpaceControl Space, Alt Escape or Shift Space, and choose the desired tag from the suggestion list. Then press Ctrl+SpaceCtrl+SpaceCtrl+SpaceCtrl+SpaceAlt+SlashCtrl+SpaceCtrl+Space or Ctrl+Back SlashCtrl+SpaceCtrl+SpaceControl SpaceControl SpaceControl SpaceControl Space, Alt Escape or Shift Space again, and choose the desired parameter name:

    ruby_createComment1

To create documentation comments for a Ruby method using intention action, do one of the following
  • Place the caret anywhere within the method you want to document, press Alt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+Enter, Shift+Alt+J or Ctrl+Shift+MAlt+EnterAlt EnterAlt EnterCommand 1Alt Enter, and choose Add @return tag. The documentation comment with the @return tag is created. Specify the return type.

    ruby_createComment2.png

  • Place the caret at the parameter you want to document, press Alt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+EnterAlt+Enter, Shift+Alt+J or Ctrl+Shift+MAlt+EnterAlt EnterAlt EnterCommand 1Alt Enter, and choose Add @param tag. The documentation comment with the @param tag for the selected parameter is created. Specify the parameter type.

    ruby_createComment3

To create tags in a documentation comment block
  1. In a comment block, select the desired empty line and type @ or : character.
  2. Press Ctrl+SpaceCtrl+SpaceCtrl+SpaceCtrl+SpaceAlt+SlashCtrl+SpaceCtrl+Space or Ctrl+Back SlashCtrl+SpaceCtrl+SpaceControl SpaceControl SpaceControl SpaceControl Space, Alt Escape or Shift Space, or just wait for Code Completion to display the suggestion list:

    doc_comment_tags

  3. Select a tag from the suggestion list. For example, you can specify the parameters type, or return type.
  4. If a certain tag has several values, press Ctrl+SpaceCtrl+SpaceCtrl+SpaceCtrl+SpaceAlt+SlashCtrl+SpaceCtrl+Space or Ctrl+Back SlashCtrl+SpaceCtrl+SpaceControl SpaceControl SpaceControl SpaceControl Space, Alt Escape or Shift Space after the tag, and select the desired value from the suggestion list. For example, RubyMine suggests to select the desired parameter name.

    code_completion_param

5.4+

Tip

Documentation comment can be created with the dedicated action Fix Doc Comment. It can be invoked by means of Find Action command.

Press Ctrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+ICtrl+Shift+AShift+Meta+AShift Command AShift Command ACommand 3Shift Command A, with the caret somewhere within a class, method, function, or field, which should be documented, and enter the action name Fix Doc String. The missing documentation stub with the corresponding tags is added. For example:

         function loadDocs(myParam1, myParam2){}

Type the opening documentation comment and press EnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnter to generate the documentation comment stub:

/**
* @param myParam1
* @param myParam2
*/

The next case lays with fixing problems in the existing documentation comments.

For example, if a method signature has been changed, RubyMine highlights a tag that doesn't match the method signature, and suggests an intention action UpdateJSDoc comment. You can also press Ctrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+ICtrl+Shift+AShift+Meta+AShift Command AShift Command ACommand 3Shift Command A, and type the action name:

fix_doc_comment_js

Note that the action has no keyboard shortcut bound with it. You can do it as described in the section Configuring Keyboard Shortcuts.

5.0+

Tip

Fill Paragraph action is supported for Ruby comments. This action creates soft wraps in comments. To make use of this action, follow these steps:

  1. Place the caret somewhere inside a comment in Ruby class.
  2. Do one of the following:
    • On the main menu, choose Edit | Fill Paragraph
    • Press Ctrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+Shift+ACtrl+ICtrl+Shift+AShift+Meta+AShift Command AShift Command ACommand 3Shift Command A, in the pop-up frame, type Fill Paragraph, and then press EnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnter,

See Also

Procedures:

Reference:

Web Resources: