RubyMine 2020.2 EAP Is Open!
We’re excited to announce the start of the Early Access Program (EAP) for RubyMine 2020.2! You can get EAP builds from our website, use the Toolbox App, or update to them using snaps if you’re an Ubuntu user. Note that the EAP builds are free to use but expire within 30 days of the build date.
As usual, we encourage you to participate in the EAP and share your thoughts on the latest improvements and the new functionality, so that we can make RubyMine better for you.
Here are the main highlights:
- Liquid template language support
- New Intention Actions
- More advanced support for GitHub pull requests
Liquid template language support
In RubyMine 2020.2, we’re happy to announce support for the Liquid template language! We plan to introduce the different kinds of features you’d expect when talking about language support, such as syntax highlighting, completion, brace matching, error warnings, and so on.
With this EAP build, you can already try some of them out.
RubyMine recognizes and highlights Liquid syntax, such as tags, and braces like {{, {{-, {%, {%-
. Standard functions like brace matching and commenting with Cmd+/ (Ctrl+/) work as well.
RubyMine can also detect issues with tags. For example, a layout tag is supposed to have a name (or state ‘none’). If it is missing, the IDE will show a warning:
Help us improve!
If you like this feature and want to help us improve it, you can test it with your projects that use Liquid and send us any issues you find. A great way to do so is to run the Syntax error inspection: go to Code | Run inspection by name and type “syntax error”:
This inspection will result in a list of errors. If any of these errors are incorrect, please feel free to report an issue to our tracker.
New Intention Actions
This EAP comes with a bunch of new intention actions to help you optimize your code. Click the bulb icon (or press ⌥⏎ / Alt+Enter) to open the list of suggestions and select an action from the list. For some intention actions, you can open a preview by pressing ⌥Space / Alt+Space.
Flip ternary and if-else operators
With the Invert ‘if else’ action, you are able to flip an if-else operator, so that the condition is negated, and the branches are switched.
The intention action for ternary operators is called Flip ‘?:’ and works the same way:
Switch between nested ‘if’ statements and boolean expressions
When you have nested if
expressions, you can use the Merge nested ‘if’ action. It will merge the nested statement into a boolean expression. To invoke this action, place the caret on the outer if
of the expression.
Split into multiple ‘ifs’ performs the opposite action, and is available with the caret on the boolean operator. Note that switching to ifs is only available on && or || operators, and only on the "topmost" one.
In cases where the nested if
itself has an elsif
or else
block, RubyMine will show a "changes semantics" label on the intention action. This emphasizes that the action will duplicate the first if
call (which may have unforeseen side effects):
Switch between ‘else/if’ and ‘elsif’ statements
With the Merge ‘else if’ and Split ‘elsif’ intention actions, you can split an elsif
statement into a nested else/if
branch and vise versa:
Add/remove clarifying parentheses
The Add clarifying parentheses intention action works for binary and ternary expressions. It adds parentheses to complex expressions that rely on operator precedence, in order to clarify how the expression would be evaluated.
You can also call the Remove unnecessary parentheses action. It will only remove the parentheses so long as semantics are not changed. For example, it’s allowed in a + (b * c)
but not in a * (b + c)
.
For ternary expressions, the parentheses are added around branches:
Introduce a new local variable
Use this intention action to introduce a new local variable when the caret is placed on an expression:
Add/remove underscores in numbers
The Add underscores action adds underscores for large numbers to aid readability. The supported types are integer/float/octal (adds an underscore every 3 digits) and hexadecimal/binary (which will put underscores every 4 characters/digits).
On the numbers with underscores, you can call the Remove underscores action.
Switch between block and line comments
You can now convert block comments into line comments and vice versa:
Note that these actions are only available for comments that begin at the start of the line, as block comments require this.
Go to super method / Go to overriding methods
You can now navigate between the super and overriding methods by calling an intention action as well as clicking the icon in the gutter:
Convert named parameters to numbered and vice versa (Ruby 2.7)
The Convert named parameters to numbered action will show up when the caret is over any named parameter (either a declaration, or usage). However, it is not available if a parameter is used in a nested context, as numbered parameters are only available in the immediate code block.
The Convert numbered parameters to named action will create an inline template that lets you rename the parameters. Any parameter that was not used is skipped and replaced with an underscore, according to the naming convention for unused variables/parameters.
Add an attr_accessor/reader/writer to an instance variable
With these intention actions, you can add attribute accessor, reader, or writer to instance variables.
Expand lazy key
In Rails applications that use lazy keys (lazy lookups), this intention action will automatically expand the key to its full form. In the case of a lazy key in a controller, it may ask which lazy key to expand it to (as there can be multiple options).
More advanced support for GitHub pull requests
RubyMine 2020.2 will come with full support for GitHub Pull Requests! With the upcoming major release, you’ll be able to browse, assign, manage, and even merge pull requests, view the timeline and in-line comments, submit comments and reviews, and accept changes.
Let’s take a look at these new features.
The first thing you’ll notice is the new layout, which lets you see all the necessary information at a glance. Now, the list of pull requests opens up in a separate tool window on the left. By double-clicking any pull request in the list, or clicking the arrow next to it, you can see all the relevant details about it. These details include PR messages, branch names, authors, assignees, changed files, commits, comments, and more.
Another important change that you’ll find in v2020.2 is the ability to start, request, and submit reviews as well as leave single comments.
You can view, edit, create, or remove the commit-level comments. The IDE now also lets you view and interact with the line-level comments so you can do a code review right from it.
Lastly, you can now merge pull requests from within the IDE.
We’ve been working hard on extending support for PRs in our IDEs, so we’d be happy to hear what you think of it! Please share your thoughts in the comments below, on Twitter, or go to our issue tracker to create and vote for features.
Important bug-fixes and other useful features
- You can now launch the irb console from Run Anything with Ruby 2.7. RUBY-25603
- RubyMine now shows a warning if you try to pass an incorrect number of parameters to stub methods (e.g. to Array.to_h(), Dir.each(), and etc.) RUBY-26096
- We’ve added the “ordinary parameter is defined” warning for all lambda cases in numbered parameters. RUBY-25405
- We’ve fixed the autocompletion for helper methods in application views RUBY-9002
- We’ve added the type support for
not
call in the active record relation chains. Now whenwhere
method is not provided any arguments, RubyMine will offernot
as a completion. RUBY-25519 - Completion in the Gemfile now shows only the latest local version of the gems RUBY-25792
- We’ve added completion for CSS selectors in querySelector methods. When manipulating the HTML DOM, you’ll now see completion suggestions for CSS selectors within
document.querySelector
,document.querySelectorAll
,element.querySelector
, andelement.querySelectorAll
calls.
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.
Happy Developing!
The RubyMine team