Early Access Program

IntelliJ IDEA 2020.3 EAP7: New UX for Extract Method Refactoring, Kubernetes Updates, SSR for Kotlin, and More

We’ve already covered many of the most prominent features that you will use in IntelliJ IDEA 2020.3 in previous EAP blog posts. However, we still have some more in store for you. In this blog post, you will discover a new UX for the Extract Method refactoring, learn how to open any file in IntelliJ IDEA by default, and get to know what’s new in IntelliJ IDEA for Kubernetes.

We invite you to test out all the new features by downloading the EAP from our website, installing it using the free Toolbox App, or updating to this latest EAP using snaps if you’re an Ubuntu user.

Java

New Extract Method layout

We’ve updated the UX for the Extract Method refactoring to make it faster and more accessible. When you select a code fragment you want to extract and press ⌥⌘M or select Refactor / Extract/Introduce / Method…, the IDE will refactor it immediately without displaying a dialog window.

After performing this refactoring, you can click the gear icon next to the method name and select additional settings in the drop-down list. If your method is extracted far from the initial location, it will be preserved in a separate frame. You can click on this frame to navigate back to the original code.

Kubernetes (Ultimate Edition)

Download logs

You can now download your pod logs to work with them locally – select a pod and click the Download Log button in the left pane of the Services tool window. The IDE will then open the downloaded pod in the editor.

By default, your pods will be saved to Scratches and Consoles | Kubernetes Files | “context” | “namespace” | pods.

There are several settings you can edit to customize the download process.

You can specify the download path for pod logs by going to Preferences / Settings | Build, Execution, Deployment | Kubernetes and changing it in the Pod Logs section. Notice that “context” | “namespace” | pods will be added to the specified path automatically.

You can also choose to specify the path every time a download commences. In this case, the logs will be saved to the exact location that you specify.

Another option in this section allows you to version your logs. If you tick the Append timestamp to pod log name when download checkbox, then each downloaded pod log will be saved separately with a timestamp in the file name. If this checkbox is clear, the IDE will overwrite the log with each new download.

Resources deletion

It is now possible to quickly delete any of your Kubernetes resources, either by clicking the garbage bin icon in the left pane of the Services tool window or by selecting Delete Resource from the context menu.

Open Console and Run Shell

You can connect containers that include consoles via Open Console, which you can invoke from the context menu or by clicking the Open Console button in the Services tool window.

If you want to launch Shell for a pod container, select Run Shell from the context menu or click the Run Shell button in the left pane of the Services tool window. The launched shell will then open in a new tab.

You can click the tools icon in the left pane of the Services tool window for quick access to Kubernetes settings. In the Pod Shell section, define which command to use for running a shell inside a container (by default, it is /bin/bash) and choose whether you want to apply this command to all projects or just to the current one.

Load CRDs from Kubernetes

Your CRD schemas provide a set of rules for creating Kubernetes resources. Currently, it is possible to load CRDs from files or from URLs. This is great, but CRDs can vary by cluster or context. For example, you can have three contexts with three different clusters. These clusters do not have the same CRDs, and they may have different versions as well.

In v2020.3, we’ve implemented a solution for such cases. In Preferences / Settings | Languages & Frameworks | Kubernetes, you can select the Use API schema from an active cluster checkbox to automatically load CRD schemas from an active cluster, if there are any.

Kotlin

Structural search and replace

In IntelliJ IDEA 2020.3 EAP7, we’ve introduced support for structural search and replace (SSR) actions for Kotlin. These allow you to find and replace code patterns, taking the syntax and semantics of the source code into account.

To invoke the Structural Search dialog, go to Edit | Find | Search Structurally…. Make sure that you have selected Kotlin as the file type. You can then write a search template or choose Existing Templates… by clicking the tools icon in the top right corner.

You can add filters for variables to narrow down your search. The following example demonstrates how to apply the Type filter:

And here is how the Text filter works:

Improved support of .editorconfig

The Kotlin plugin API fully supports an .editorconfig file that keeps your code formatting settings.

User Experience

Preview tab

Now you can open a file in a preview tab with a single click. To enable this feature, click the gear icon in the Project view and select both Enable Preview Tab and Open Files with Single Click. If you start editing a file opened in this way, it will cease to be a preview and will become an ordinary file.

Setting IntelliJ IDEA as the default application for opening files

Starting with v2020.3, you can make IntelliJ IDEA a default application for opening files. Go to Preferences | Settings / Editor / File Types and click the Associate file types with IntelliJ IDEA… button. In the dialog, select the extensions for files you wish to open in IntelliJ IDEA and click OK.

On macOS you have to restart your computer for changes to be applied.

The selected file extension associations will remain unchanged when you upgrade to a newer version of your IDE.

That’s it for this week! Test out the new features and share your thoughts in the comments below, on Twitter, or via our issue tracker.

If you want to learn more about other improvements coming in IntelliJ IDEA 2020.3, you can check out the release notes for a full list of EAP features.

Happy developing!

image description

Discover more