RubyMine 6.3.0 Web Help

Basic code completion helps you complete the names of classes, methods, and keywords within the visibility scope. When you invoke code completion, RubyMine analyses the context and suggests the choices that are reachable from the current position of the caret.

If basic code completion is applied to a part of a parameter, or variable declaration, RubyMine suggests a list of possible names with regard to the type of the item.

Invoking Basic code completion for the second time shows the list of all the declared names.

Code completion covers supported file types and custom file types. However, RubyMine does not recognize the structure of custom file types and suggests completion options regardless of whether a specific type is appropriate in the current context.

The sections below illustrate various cases of code completion:

To automatically complete names in the current visibility scope, follow these general steps:
  1. Type a name or a part of a name.

    Tip

    While typing, use the following techniques:

    • Narrow down the suggestion list by typing any part of a word, even the characters somewhere in the middle, or invoking code completion after a dot separator. RubyMine will show suggestion list that includes occurrences with all the possible positions of the entered characters. 5.0+

      This makes the use of the asterisk wildcard unnecessary:

      codeCompletionWildcard.png

    • In case of CamelCase or snake_case names, type the initial letters only. So doing, RubyMine automatically recognizes and matches the initial letters.
  2. Do one of the following:
    • On the main menu, choose Code | Completion | Basic.
    • Press Ctrl+SpaceCtrl+SpaceCtrl+SpaceCtrl+SpaceAlt+SlashCtrl+SpaceCtrl+Space or Ctrl+Back SlashCtrl+SpaceCtrl+SpaceControl SpaceControl SpaceControl SpaceControl Space, Alt Escape or Shift Space.
  3. If necessary, press Ctrl+SpaceCtrl+SpaceCtrl+SpaceCtrl+SpaceAlt+SlashCtrl+SpaceCtrl+Space or Ctrl+Back SlashCtrl+SpaceCtrl+SpaceControl SpaceControl SpaceControl SpaceControl Space, Alt Escape or Shift Space for the second time.

    This shows the list of all the declared names.

    web_ide_completing_class_name.png

    Tip

    This action produces the same effect as pressing Ctrl+Alt+SpaceCtrl+Alt+SpaceCtrl+Alt+SpaceCtrl+Alt+SpaceCtrl+Alt+SpaceCtrl+Alt+SpaceCtrl+Alt+Space or Ctrl+Alt+Back SlashCtrl+Alt+SpaceCtrl+Alt+SpaceControl Alt SpaceControl Alt SpaceControl Alt SpaceControl Alt Space.

  4. Select the desired class from the suggestion list, and do one of the following:
    • Press EnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnterEnter or double-click the desired choice .
    • Press TabTabTabTabTabTabTabTabTabTabTabTabTab .

Tip

  • The option Autocomplete common prefix (Settings | IDE Settings | Code Completion) makes RubyMine look for common prefixes and automatically complete them in the editor. This feature is useful for classes with numerous similar-named members.
  • If a suggestion list shows n variants of a class, type a dot, and the next suggestion list after dot will show all the possible qualified names of the members. After selecting the desired one, import statement will be added automatically.
  • Suggestion list includes literals, already defined in a file:

    completeLiteral

See Also

Procedures:

Reference:

External Links:

Web Resources: