Improved YAML Support in the Updated RubyMine 2018.2 EAP
Hey all,
RubyMine 2018.2 EAP (build 182.2574.11) has just been updated. The new build improves YAML support across all IntelliJ-based IDEs, and RubyMine is no exception. Apart from that, the new build also provides new intention actions for Ruby.
Code insight for YAML anchors and aliases
Autocompletion
Once you’ve defined an anchor in your document, you can autocomplete its aliases simply by pressing Enter, instead of typing them out:
Code navigation
This trademark feature of all JetBrains IDEs now works for aliases. Press Cmd+click / Ctrl+click on an alias to navigate to its anchor definition. Back-click on an anchor to see the list of its aliases and navigate to any of them:
Find usages
Usages of aliases can now be found just like Ruby variables, parameters, and methods: put your caret to an alias, and choose Find usages from the context menu. Alternatively, press Alt+F7:
Inline renaming
Inline renaming aliases and their anchors is also available now. As usual, put the caret on an alias or an anchor, and go to Refactor | Rename. Or simply press Shift+F6:
By the way, RubyMine will warn you if you try to provide a name that is already used for another anchor if this creates conflicts:
Also, the IDE will not allow you to rename acnhors using characters that aren’t allowed by the standard. For instance, if you try to insert a space and save the new name, it will suggest that you continue editing the name, or cancel the process:
Inspections
In addition to code completion and navigation, we’ve added a number of YAML inspections:
First of all, RubyMine will warn you if you try to define multiple anchors or tags:
The IDE will also report an error if you provide an alias that doesn’t have an anchor:
Finally, RubyMine will catch and report recursions:
Should you face any issues with the new YAML features, please refer to the related ticket: [RUBY-21454]
More intention actions for Ruby
In this build, you will also discover improved intention actions for conditional statements. For instance, RubyMine now suggests replacing `while` with `until`:
The IDE also helps replace bad-style negative statements, like this one:
Related issue: [RUBY-21634]
As usual, see the release notes for the full list of improvements, and please report any issues you encounter.
Cheers,
Your RubyMine Team