JetBrain is a great company dedicated to creating the best integrated development environment in the world for developers

Just last week, JetBrain released the latest version of Its Java integrated development environment IntelliJ IDEA 2018.3 Beta. In this post, I’ll take a look at some of the key features of the update, based on the official blog and my own understanding.

1. Refactor classes, files, symbols, Action search

IntelliJ IDEA (hereinafter referred to as IDEA) search can be divided into the following categories

  1. Class search, such as Java, Groovy, Scala class files
  2. File search, all files other than class files
  3. Symbol search, including interface name, class name, function name, member variable, etc
  4. Action search to find your Action
  5. String search and replace

In the world of IDEA, search is everywhere, and you can find any line of code or even any word you want almost instantly. In the new version, IDEA seamlessly combines class, file, symbol, Action Search with double Shift Search Everywhere.

In the old version, class, file, symbol, and Action searches were independent shortcuts. In the new version, when any one of these types of searches is triggered, the following window pops up

As you can see from the above demonstration, we call up the search class window, which will first display the results of the search based on the class name. If you want to reuse the characters currently entered to search based on other semantics (such as files or symbols), just press Tab and the results will appear instantly.

2. Redesigned structure search/Replace dialog

In fact, in addition to the above five types of search in IDEA, there is also a very powerful search called structured search, you can search the results you need based on a certain code structure.

For example, if we want to search for all try and catch blocks, we can enter the following text after calling up the structured search box

try {
  $TryStatement$;
} catch($ExceptionType$ $Exception$) {
  $CatchStatement$;
}
Copy the code

IDEA will then search for all try and catch blocks, and this is enhanced by the new version. I will use two GIFs to demonstrate the two features of this update

Structured search because the input text is long, so generally we will prepared some templates, and then to the template name, and then in the structured search, we can directly based on the template name to search, the new update of the first function is, in a text input box, press the smart completion key, can quickly bring up the template, according to a recent search history, Then press Enter again, the text will automatically fill in for you, you can also click on the search icon in the upper left corner, will also show your recent search records, these records are shown in text

The text above is the built-in structured template try’s. After clicking the Find button, all the tries and catches are displayed. We can further filter, for example, we want to Find the exception whose name is Flash. Add a Text filter to the corresponding template variable

More tips in the “Flash blog” after the public account, reply idea can be obtained.

3. Run everything

You can double click the CTRL key to bring up the Run Anything window. You can type Anything to Run Anything you want, such as a Tomcat container, a unit test, or even terminal commands, Gradle, or maven build commands

Alternatively, you can hold down the Shift key and all debug-enabled runs will change to debug mode in seconds

4. Reconstruct the plug-in center

Many powerful functions in IDEA are implemented through plug-ins, for example, install a language plug-in, IDEA transformed into nodeJS IDE, PHP IDE, Python IDE, Scala IDE, GO IDE, I installed 30+ very easy to use plug-ins.

In the new version of IDEA, JetBrain is a complete overhaul of the plug-in center, as shown below

Once the plug-in configuration is invoked, the page is divided into three major sections

  1. Marketplace: Plugin market, you can search for the plugin you want
  2. Installed: all currently installed plug-ins, you can also click on the upper left corner of the search icon, by category to view the currently installed plug-ins, whichcustomThe option is to download and install the plug-in yourself
  3. Updates: Any updates to the currently installed plug-ins will be displayed here
  4. The last one is configuration items, you can customize your repository of plugins, you can configure HTTP proxies for plugins to download (especially if foreign network access is poor), and you can install plugins from your local hard drive

5. An ever-improving version control system

Personally, I’m not a big fan of graphical interfaces for version control, but IDEA is so good for version control design that I can only fall for it

5.1 making the Pull Requests

With support for GitHub Pull Requests added, you can now create or view Pull Requests for projects directly on your computer

You can also create a branch directly based on a Pull Request, or view the current Pull Request directly on Github, which is a great feature for open source workers.

5.2 Git submodule support

In addition, the new IDEA has more friendly support for Git submodules. If you have a Git submodule in your project, you will be able to clone the code locally. In addition, you will be able to commit any changes to any files in your project, and the IDEA will be matched to the outer submodule or submodule. Then push to multiple warehouses simultaneously.

5.3 Improved Annotate the support

Sometimes we inadvertently format code that we or someone else has written, which can result in a messy diff every time we commit, even if only one or two pieces of code have been updated. Most of the diff is caused by whitespace.

In the new version of IDEA, we can choose to ignore whitespace when comparing files

Note: This option is turned on by default

Alternatively, you can choose to ignore whitespace when merging code

This way, you won’t see any space-related changes during conflict resolution, saving valuable attention.

IDEA’s support for version control is so powerful, more version control skills can be found in the flash’s official blog, reply IDEA.

6. New themes

IDEA has finally added a default theme in this release, which is a high contrast theme that many people will like

It is expected that in the near future, IDEA will work hard on the theme, after all, I think the theme of VS Code is pretty good, IDEA can be absorbed.

7. Editor improvements

7.1 Multi-line TODO comments

In IDEA, once you add the todo keyword in the comment, the todo TAB in the sidebar can see the current unfinished function, as shown below

In the old version, multi-line todo comments were not supported. In the new version, if a todo comment has multiple lines, you simply add a space before the next few lines

7.2 Indent the status bar

IDEA now displays the indented space of the current file in the status bar. You can click on the status bar to control the indented style of the current file.

For example, if your project is 4 Spaces indented and some new guy writes a tabbed source file and submits it, you can just click on Configure Indents For Java… , and then make some changes

7.3 Switching Between Source Files quickly on TAB

You can now use Tab+ numbers to quickly switch to the file you want, faster than a mouse click

7.4 Multi-line string search

In the new version of IDEA, you can search not just strings, but entire paragraphs

JVM debugger

8.1 Attach to any Java process

IDEA debug is very important for debugging errors and reading source code. The new version of IDEA is further enhanced to debug not only the current application, but also to attach to any Java process. After attaching, you can see the thread state of the process and use the powerful Memory View function to see the current state of Memory.

8.2 Remote Debugging Supports asynchronous stack tracing

IDEA supports remote debug, almost like local debug. You only need to enable the remote port.

IDEA also supports debugging asynchronous threads. When a breakpoint is placed on a line, you can see not only the call stack for that line, but also the call stack for the external thread that started that line.

Asynchronous stack support has also been added for remote debugging, using the following two steps

  1. copy/lib/rt/debugger-agent.jarTo remote machine
  2. Adding startup Parameters-javaagent:debugger-agent.jarTo remote machine

How to use the debug function to quickly find the error, how to read the source code through the debug lightning, in the attention of “flash blog” after the public number, reply idea can get cool god technology.

9. Run the configuration

9.1 configuration macro

When we run the application, sometimes we need to set different startup parameters to see different effects, in the past, these parameters need to be manually typed in, and often forget the purpose of the current startup parameters test, very troublesome.

Now, you can enter the parameters as macros ahead of time. You don’t have to change the text of the startup parameters repeatedly by adjusting the macro while debugging. You can also see what the current startup parameters are tested for in the macro text.

9.2 Using text as console input

The new version of IDEA allows you to specify a text file as the console input. This way, you can pre-define the console input and reuse it to improve efficiency

10. JVM Profiler

The final feature, and perhaps the biggest highlight of this update, is that IDEA can now analyze the performance of Java applications

  1. You can analyze the CPU consumption of all threads in a Java process, or you can select only one thread to analyze
  2. Method call graph to find the methods that consume the most CPU in a given thread
  3. Method list, you can see the number of times each method was called, click on it and you can see the detailed call stack

The following chapter is illustrated with giFs, and readers can explore the details on their own

With this artifact, you can perform application performance analysis directly in IDEA without the need for additional profiler tools. It is expected that In the near future, Eclipse MAT related functions may also be ported to IDEA, at that time, Java application performance analysis, heap analysis, GC analysis can All run In IDEA, the true All In One era is coming!

11. More…

In addition, this update also the function of a large number of small update, when you are using the new IDEA of experience, not here, one quickly download experience, download address: www.jetbrains.com/idea/nextve…

IntelliJ IDEA 2018.1 is a new version of IntelliJ IDEA 2018.1 is a new version of IntelliJ IDEA 2018.1

If you like this post, you are welcome to subscribe to flash’s blog by clicking on the image below and replying to “idea” for instant access to IntelliJ Idea