RubyMine 2018.2 Help

YAML

RubyMine enables you to work with YAML files (*.yml, *.yaml) and supports the following capabilities:

Let’s see on some YAML-specific features available in the editor.

Anchors and aliases

RubyMine supports working with anchors and aliases. If you specify a new anchor in the YAML file, the editor will show a warning that this anchor is not used by any node.

yaml unused anchor warning

The editor enables you now to complete aliases for this anchor.

yaml complete alias

You can navigate from aliases to the anchor using the Ctrl+B shortcut.

yaml navigate anchor

For the anchor, you can do the same and find all corresponding aliases.

yaml navigate aliases

RubyMine also supports the rename refactoring for anchors and aliases.

Note that the Structure view (Alt+7) allows you to manage whether to display nodes for aliases. Use the Show aliases sub-trees button (icons nodes expandNode) to do this.

yaml structure view

Remote JSON schemas

RubyMine supports autocompletion and inspections for YAML files using the specified JSON schema. For instance, if you use the .travis.yml file for Travis CI configuration, RubyMine will suggest you complete its options using the JSON schema loaded from schemastore.org:

yaml complete json

You can manage loading JSON schemas using the Languages & Frameworks | Schemas and DTDs | Remote JSON Schemas page of the Settings/Preferences dialog (Ctrl+Alt+S).

If necessary, you can specify a path to the required schema file in the Languages & Frameworks | Schemas and DTDs | JSON Schema Mappings page.

Copying keys

RubyMine provides the ability to copy a full path to a specific option specified in the YAML file. For instance, this can be useful when copying key paths from localization files. You can do this in two ways:

  • Place a caret to the required key and press Ctrl+Shift+Alt+C.
  • Hover over the required key, right-click it and select Copy Reference.
yaml copy references

For the localization key on the image above, the en.likes.create.error value will be copied.

Last modified: 31 August 2018