Hello, I’m Guide!

Last night, I found a highly efficient use of IDEA tutorial with more than 370 likes on Zhihu. With curiosity, I clicked to have a look. Boy, this is another disgusting behavior of stealing others’ original ideas for drainage.

What makes me wonder is that the content of this article is so poor and out of date (originally written in 2018) that it still gets over 370 likes. My own very much article others steal hair hundreds of points praise, my own hair single-digit points praise, very strange work, said much is tears……

Therefore, I used the time last night and this morning to summarize the efficient use of IDEA tutorial. Hope to help everyone!

This paper is divided into the following four parts:

  1. IDEA Efficient setup guide
  2. Some must-have plug-in recommendations
  3. Subject to optimize
  4. IDEA source reading skills

01 Efficient Settings

Let’s start by talking about some Settings that IDEA can use better after tweaking. First of all, this is just a suggestion based on my personal preferences and habits. The default configuration of IDEA already works well. Whether to modify it depends on your personal preferences and habits.

Adjust the font size of the window

Great use of a function! Strong Amway!

Check on the Preferences/Settings | Editor | Change the font size under the General with the Command + Mouse Wheel options, ⌘+ mouse wheel (Mac)/Ctrl+ mouse wheel (Windows&Linux) to change the window font size directly

font

Modify the Preferences/Settings | Editor | the Font options under the Font, Font is recommended to use JetBrains Mono, Font size suggests 16/18, according to individual need to choose whether to need to open even a word.

When hyphenation is enabled, the code becomes more readable.

Configure the class annotation template

Modify the Preferences/Settings | Editor | File adn Class under the Code Templates and template of Enum.

The class annotation template for my daily project is configured as:

/** * you can get your original Java interview manual for free by searching JavaGuide on wechat@authorThe elder brother of the Guide *@date ${YEAR}/${MONTH}/${DAY} ${HOUR}:${MINUTE}
 **/
public class ${NAME} {
}
Copy the code

To optimize the Live Templates

IDEA has its own coding template. We usually use it when coding. I don’t know if you have noticed. For example, if you type sout, you can print a line of output statements system.out.println (); .

You can modify the IDEA encoding templates to suit your preferences, and you can add new ones to speed up the coding. Very useful!

Global Settings SDK

Modify File -> New Projects Setup -> Structure… | Project under the Project SDK options, change it to you the most commonly used Java version.

This way, any new projects you import or create will use this version of the SDK by default.

Automatic package guide & delete useless packages

Check on the Preferences/Settings | Editor | General | Auto Import under the specified options can!

IDEA will automatically guide packages for you (only if you are sure) and remove packages that are not used in your code.

Display method divider line

Check on the Preferences/Settings | Editor | General | under the Appearance of the Show method separators options after method line had, this will slightly improve the readability of the code.

02 Required Plug-ins

There are too many plug-ins to use. I only recommend 6 IDEA plug-ins that I use most frequently. More plug-ins can be recommended to see my “IDEA Topic”.

Jclasslib: bytecode viewer artifact

Using JClasslib, you can visually view not only the bytecode files corresponding to a class, but also the basic information, constant pools, interfaces, properties, functions, and more.

Tabnine: Ai-based code hints

Tabnine was formerly known as Codota. I’ve been using a plugin that works pretty well.

Tabnine is a plug-in for intelligent code completion, which is based on millions of Java programs and is able to complete code according to application context cues. Tabnine and IDEA complement each other with built-in intelligent cues.

If you feel the IDEA plugin installed too much more sluggish words, do not worry! The Tabnine plugin also has an online counterpart where you can search for code examples by code keyword, which is great! Website: www.tabnine.com/.

Key Promoter X: Shortcut Key Prompt

The main function of this plugin is to remind you to use shortcut keys where you could have used them.

Let me give you an example. When I click on the TAB menu to open Version Control, the plugin prompts you to use the command+9 shortcut or Shift + Command +9 shortcut. As shown in the figure below.

It also shows you which shortcuts you forget to use the most!

Alibaba Java Code Guidelines: Alibaba Java Code Guidelines

Alibaba Java code specification, the corresponding Github address is: github.com/alibaba/p3c… . Installation is highly recommended!

After the installation is complete, it is suggested to replace the language with Chinese, prompting a little more friendly.

According to the official description:

At present, the plug-in implements 53 rules in the development manual, most of which are implemented based on PMD. Among them, 4 rules are implemented based on IDEA, and real-time detection function is implemented based on IDEA Inspection (New Window). Some rules implement the Quick Fix function. For those that can provide a Quick Fix but don’t, we will implement it as soon as possible. We also welcome students who are interested to join us. At present, there are two modes of plug-in detection: real-time detection and manual trigger.

The development manual mentioned above is the well-known “Alibaba Java development Manual” in the Java development field.

The plug-in will detect in real time where our code doesn’t match its rules and suggest changes. For example, if we create a thread pool in the following way, the plugin will detect it for us, as shown below.

SequenceDiagram: One-click generation of sequence diagrams

With the SequenceDiagram plugin, we can generate sequence diagrams with one click. Also, you can:

  1. Click on the class/method in the sequence diagram to jump to the corresponding location.
  2. Removes the corresponding class or method from the sequence diagram.
  3. Export the generated sequence diagram as a PNG image.

Save Actions: Optimizes file saving

This plugin can help us save files when:

  1. Optimized import;
  2. Formatting code;
  3. Perform some Quick fixes
  4. .

Rainbow Brackets: Rainbow Brackets

Use a variety of bright colors to display your parentheses, as shown below. You can see that the code hierarchy is much clearer, and it is very useful and friendly!

03 Theme Optimization

In these several IDEA theme is also too good-looking!! In this article, I selected several IDEA themes suitable for Java coding for friends to choose (I myself use the One Dark theme).

Very uncomfortable, in the spirit of a good intention to send this article, the results were sprayed, many partners said that MY aesthetic is not good, there are some partners said fancy, not the original theme good-looking.

Radish cabbage each has his love! Is it difficult to maintain an inclusive mindset? You can not install any plug-ins, but do not think that others install plug-ins is redundant, IDEA plug-ins are one of the soul of IDEA, this can not be denied the fact.

04 IDEA source code reading skills

In the very delicious! With IDEA artifact to see the source code, efficiency is really high! In this article, I introduced their usual look at the source of the time commonly used shortcuts/tips! Very useful!

Master these shortcuts/tips, using IDEA to see the efficiency of the source code to improve a level!