# Advanced completion

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/ruby/2026.3/llms.txt).

## Statement completion

You can create syntactically correct code constructs by using statement completion. It inserts the necessary syntax elements (parentheses, braces, and semicolons) and gets you in a position where you can start typing the next statement.

To invoke statement completion, start typing a code construct and press `Ctrl+Shift+Enter` (Windows), `⌘ ⇧ ⏎` (macOS), `⌘ ⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ ⏎` (macOS System Shortcuts), `Ctrl+Shift+Enter` (XWin), `Ctrl+Shift+Enter` (GNOME), `Ctrl+Shift+Enter` (KDE), `Ctrl+Shift+Enter` (Emacs), `Ctrl+Shift+Enter` (Sublime Text), `Ctrl+Shift+Enter` (Sublime Text (macOS)), `Ctrl+Shift+Enter` (Visual Studio), `⌘ ⇧ ⏎` (Visual Studio (macOS)), `Meta+Shift+Enter` (TextMate), `Ctrl+Shift+Enter` (NetBeans), `Ctrl+Shift+Enter` (Eclipse), `⌘ ⇧ ⏎` (Eclipse (macOS)).

Procedure: Complete a method or function declaration

* Start typing a method or function declaration and press `Ctrl+Shift+Enter` (Windows), `⌘ ⇧ ⏎` (macOS), `⌘ ⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ ⏎` (macOS System Shortcuts), `Ctrl+Shift+Enter` (XWin), `Ctrl+Shift+Enter` (GNOME), `Ctrl+Shift+Enter` (KDE), `Ctrl+Shift+Enter` (Emacs), `Ctrl+Shift+Enter` (Sublime Text), `Ctrl+Shift+Enter` (Sublime Text (macOS)), `Ctrl+Shift+Enter` (Visual Studio), `⌘ ⇧ ⏎` (Visual Studio (macOS)), `Meta+Shift+Enter` (TextMate), `Ctrl+Shift+Enter` (NetBeans), `Ctrl+Shift+Enter` (Eclipse), `⌘ ⇧ ⏎` (Eclipse (macOS)) after the parenthesis.   RubyMine adds `end` for methods, classes, modules, conditionals (`if, unless, case`), and blocks (`do … end`).

Before:

```RUBY
def paint # caret
```

After:

```RUBY
def paint
    # caret
end
```

Procedure: Complete a code construct

* Start typing a code construct and press `Ctrl+Shift+Enter` (Windows), `⌘ ⇧ ⏎` (macOS), `⌘ ⇧ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ ⇧ ⏎` (macOS System Shortcuts), `Ctrl+Shift+Enter` (XWin), `Ctrl+Shift+Enter` (GNOME), `Ctrl+Shift+Enter` (KDE), `Ctrl+Shift+Enter` (Emacs), `Ctrl+Shift+Enter` (Sublime Text), `Ctrl+Shift+Enter` (Sublime Text (macOS)), `Ctrl+Shift+Enter` (Visual Studio), `⌘ ⇧ ⏎` (Visual Studio (macOS)), `Meta+Shift+Enter` (TextMate), `Ctrl+Shift+Enter` (NetBeans), `Ctrl+Shift+Enter` (Eclipse), `⌘ ⇧ ⏎` (Eclipse (macOS)).

RubyMine automatically completes the construct and adds `end`. The caret is placed at the next editing position.

Before:

```RUBY
if art.nil? # caret
```

After:

```RUBY
if art.nil?
    # caret
end
```

## Hippie completion

Hippie completion is a completion engine that analyses your text in the visible scope and generates suggestions from the current context. It helps you complete any word from any of the currently opened files.

Procedure: Expand a string at caret to an existing word

1. Type the initial string and do one of the following:

* Press `Alt+/` (Windows), `⌥ /` (macOS), `⌥ /` (IntelliJ IDEA Classic (macOS)), `⌥ /` (macOS System Shortcuts), `Alt+/` (XWin), `Alt+/` (GNOME), `Alt+/` (KDE), `Alt+/` (Emacs), `Alt+/` (Sublime Text), `⌥ /` (Sublime Text (macOS)), `Alt+/` (Visual Studio), `⌥ /` (Visual Studio (macOS)), `Alt+/` (TextMate), `Ctrl+Shift+K` (NetBeans), `Alt+/` (Eclipse), `⌃ .` (Eclipse (macOS)) or choose `Code | Code Completion | Cyclic Expand Word` to search for matching words before the caret.

* Press `Alt+Shift+/` (Windows), `⌥ ⇧ /` (macOS), `⌥ ⇧ /` (IntelliJ IDEA Classic (macOS)), `⌥ ⇧ /` (macOS System Shortcuts), `Alt+Shift+/` (XWin), `Alt+Shift+/` (GNOME), `Alt+Shift+/` (KDE), `Alt+Shift+/` (Emacs), `Alt+Shift+/` (Sublime Text), `⌥ ⇧ /` (Sublime Text (macOS)), `Alt+Shift+/` (Visual Studio), `⌥ ⇧ /` (Visual Studio (macOS)), `Alt+Shift+/` (TextMate), `Ctrl+K` (NetBeans), `Alt+Shift+/` (Eclipse), `Alt+Shift+/` (Eclipse (macOS)) or choose `Code | Code Completion | Cyclic Expand Word (Backward)` to search for matching words after the caret and in other open files.

The first suggested value appears, and the prototype is highlighted in the source code.

![Expand word](https://resources.jetbrains.com/help/img/idea/2026.3/rm_expandWord.animated.gif)

2. Accept the suggestion or hold the `Alt` (Windows), `Alt` (macOS), `Alt` (IntelliJ IDEA Classic (macOS)), `Alt` (macOS System Shortcuts), `Alt` (XWin), `Alt` (GNOME), `Alt` (KDE), `Alt` (Emacs), `Alt` (Sublime Text), `Alt` (Sublime Text (macOS)), `Alt` (Visual Studio), `Alt` (Visual Studio (macOS)), `Alt` (TextMate), `Alt` (NetBeans), `Alt` (Eclipse), `Alt` (Eclipse (macOS)) key and keep pressing `\` (Windows), `\` (macOS), `\` (IntelliJ IDEA Classic (macOS)), `\` (macOS System Shortcuts), `\` (XWin), `\` (GNOME), `\` (KDE), `\` (Emacs), `\` (Sublime Text), `\` (Sublime Text (macOS)), `\` (Visual Studio), `\` (Visual Studio (macOS)), `\` (TextMate), `\` (NetBeans), `\` (Eclipse), `\` (Eclipse (macOS)) until you find the word you need.

## Completion of tags and attributes

RubyMine automatically completes names and values of tags and attributes in many file types:

* HTML/XHTML, including [completion for CSS classes](css.html#ws_css_complete_class_in_html_tags) and for [HTML tags inside JSX](react.html#react_code_completion_html_tags_and_components). > **Tip:** > If [Emmet support is enabled](using-zen-coding-support.html#ws_emmet_enable), Emmet templates are also completed automatically in the HTML and XML contexts.

* [XML/XSL](null), including completion for namespaces. > **Note:** > Available only in RubyMine with the Ultimate subscription.

* JSON. For more information, refer to [Editing package.json](installing-and-removing-external-software-using-node-package-manager.html#ws_npm_yarn_edit_package_json).

Procedure: Complete tag names

1. Type the opening `<` and then start typing the tag name. RubyMine displays the list of tag names appropriate in the current context.

Use the `Up` (Windows), `↑` (macOS), `↑` (IntelliJ IDEA Classic (macOS)), `↑` (macOS System Shortcuts), `Up` (XWin), `Up` (GNOME), `Up` (KDE), `Up` (Emacs), `Up` (Sublime Text), `↑` (Sublime Text (macOS)), `Up` (Visual Studio), `↑` (Visual Studio (macOS)), `Up` (TextMate), `Up` (NetBeans), `Up` (Eclipse), `↑` (Eclipse (macOS)) and `Down` (Windows), `↓` (macOS), `↓` (IntelliJ IDEA Classic (macOS)), `↓` (macOS System Shortcuts), `Down` (XWin), `Down` (GNOME), `Down` (KDE), `Down` (Emacs), `Down` (Sublime Text), `↓` (Sublime Text (macOS)), `Down` (Visual Studio), `↓` (Visual Studio (macOS)), `Down` (TextMate), `Down` (NetBeans), `Down` (Eclipse), `↓` (Eclipse (macOS)) keys to scroll through the list.

2. Press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (TextMate), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)) to accept a selection from the list. If your file is associated with a schema or a DTD, RubyMine automatically inserts the mandatory attributes according to it.

Procedure: Import a taglib declaration

If you need to use tags declared in a tag library, you need to import this taglib before any custom tag from it can be used.

1. Start typing a taglib prefix and press `Alt+Insert` (Windows), `⌘ N` (macOS), `⌃ N` (IntelliJ IDEA Classic (macOS)), `⌘ N` (macOS System Shortcuts), `Alt+Insert` (XWin), `Alt+Insert` (GNOME), `Alt+Insert` (KDE), `Alt+Insert` (Emacs), `Alt+Insert` (Sublime Text), `⌘ N` (Sublime Text (macOS)), `Alt+Insert` (Visual Studio), `⌘ ⌃ N` (Visual Studio (macOS)), `Ctrl+N` (TextMate), `Alt+Insert` (NetBeans), `Alt+Insert` (Eclipse), `⌘ N` (Eclipse (macOS)).

2. Select a taglib from the list and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (TextMate), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

RubyMine imports the selected taglib and adds the import statement automatically.

Procedure: Insert a tag declared in a taglib

1. Start typing a tag and press `Ctrl+Alt+Space` (Windows), `⌃ ⌥ Space` (macOS), `⌃ ⌥ Space` (IntelliJ IDEA Classic (macOS)), `⌃ ⌥ Space` (macOS System Shortcuts), `Ctrl+Alt+Space` (XWin), `Ctrl+Alt+Space` (GNOME), `Ctrl+Alt+Space` (KDE), `Ctrl+Alt+Space` (Emacs), `Ctrl+Alt+Space` (Sublime Text), `⌃ ⌥ Space` (Sublime Text (macOS)), `Alt+Shift+Space` (Visual Studio), `⌥ ⇧ Space` (Visual Studio (macOS)), `Ctrl+Alt+Space` (TextMate), `Ctrl+Alt+Space` (NetBeans), `Ctrl+Alt+Space` (Eclipse), `⌃ ⌥ Space` (Eclipse (macOS)).

2. Select a tag from the list. The `uri` of the taglib it belongs to is displayed in brackets.

3. Select a taglib and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (TextMate), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)). RubyMine adds the declaration of the selected taglib.

