RubyMine 2020.2 EAP2: Improvements for Liquid Template Language, New Intention Actions, and More

Nataliia Kudanova

RubyMine 2020.2 EAP2 is now available! In this version, we’re continuing our work on Liquid template language support. We’ve also added new intention actions, and improved the folding of if/while/for statements:

Liquid template language support improvements

Live templates

This EAP version comes with live templates for Liquid. Live templates (or code snippets) allow you to insert frequently-used constructions into your code. These can be conditions, blocks, loops, and so on.

To invoke a live template, start typing and press Tab:

Live templates for liquid

To see and configure the available live templates, go to the Settings/Preferences | Editor | Live Templates page:

Live templates setup

Folding

RubyMine now recognizes code blocks and allows you to fold tags with code blocks, for example the {% liquid %} tag, if-else statements, and so on:

Folding of liquid tags

Reformatting the code

RubyMine lets you reformat your Liquid code according to the requirements you’ve specified in the Code Style settings. Access the settings in Settings/Preferences | Editor | Code Style.

To run reformatting, either go to Code | Reformat or select the code fragment you want to reformat and press ⌥⌘L (Ctrl+Shift+L) in the editor. You can also reformat a file or a group of files. Learn more about it in the documentation.

Reformatting liquid code

Comments inside the code blocks

We’ve already implemented support for the {% comment %}...{% endcomment %} tags. Starting with this build, comments inside Liquid tags are also supported:

Comments inside the liquid tag

New intention actions

Merge/split sequential ‘if’s

This intention action is available on the elsif or if keywords. It suggests merging two branches if the code inside these branches is exactly the same. RubyMine will then combine the two conditions using an || operator and add parenthesis if necessary.

The Split into multiple ‘if’s action will do the opposite.

Merge or split sequential ifs

Expand or
namespace

These intention actions will expand lines with the :: scope resolution operators into nested modules and vise versa. Note that the Flatten namespace action will flatten the modules above it:

Expand or flatten namespace

Improved readability of folded if/while/for statements

For folded constructs, like if, while, and for, RubyMine will now show the condition or variables used in the first line. This approach makes it easier to see whether you need to unfold the construct and look into it.

Improved readability of folded statements

Early Access Program Key Facts

  • The EAP version of RubyMine is free to use. It will expire in 30 days.
  • This is pre-release software, and it may not work as intended.
  • You can install the EAP version alongside a stable version of RubyMine.
  • EAP versions of RubyMine report statistics by default. These statistics help us improve user experience. You can opt-out by changing the settings in Preferences/Settings | Appearance & Behavior | System Settings | Data Sharing.
  • EAP versions have their own documentation as well.

Join the Early Access Program

You are welcome to download the latest EAP build from our website or via the Toolbox app. The full list of closed tickets in this EAP build is in the release notes.

To learn about the newest features as they come out, please follow RubyMine on Twitter. We post product news and tips several times a week.

As always, we encourage you to share your thoughts in the comments below and to create and vote for features in the issue tracker.

DOWNLOAD RUBYMINE 2020.2 EAP2

Happy Developing!
The RubyMine team

Subscribe

Subscribe for updates