Intellij IDEA Super useful tips “With plugin theme sharing”

preface

Although I have been using IDEA for a long time, I have only used some basic functions of this powerful tool, so I specially sorted out some practical tips of Intellij IDEA software. Hope after reading this article can let everyone more efficient study life.

All screenshots and tests in this article are based on Intellj IDEA of macOS 2020.1

configuration

The official instructions address: www.jetbrains.com/help/idea/d…

Since there is no official Chinese version of the document, it is recommended that those who do not speak English can use Google Translate.

PS: Switch to the corresponding shortcut key version before reading

Here are a few configurations that I personally find quite useful

  1. Automatic package import

Preferences -> Editor -> General -> Auto ImportInsert imports on paste automatically. In the figure, All is selected, which is the default insert. It is generally recommended to select Ask to confirm whether to import the package.2. Multi-line displayPreferences -> Editor -> General -> Editor TabsYou can adjust the number of tabs and whether to wrap. You are advised to deselect the screen with a large size, select automatic line wrapping, and increase Tab Limit to reserve more files.Below is an illustration of the line break3. The line number is displayedPreferences -> Editor -> General -> AppearanceThis configuration is highly recommended, because normal error reports will prompt the corresponding number of lines, daily error search is clear at a glance. ! [image-20210115093041534] assets/image-20210115093041534.pngOf course you can get through without opening itcommand + LQuickly jump to the specified line “Windows:ctrl + G4. Code template configurationPreferences -> Editor -> Live TemplatesYou can configure the templates according to your daily needs, and here I set up custom annotations for classes and methodsMy class annotation configuration is shown above, and because I use the Time and date variables, I also need to click Edit Variables to bind name and expression.After configuring the template, we just need to type/C normally and the prompt will prompt classInfo to click Enter to directly add the template comments

Essential shortcut keys

Frequently used shortcuts are marked at 🌟 for easy reading

The query

introduce shortcuts
Retrieve text in the project 🌟 command + Shift + F
Quick search for “ALL” shift + shift
To find the class 🌟 command + N
Find the directory command + shift + NThe input/
Symbol search “fuzzy search” command + option + O

Compile operation

introduce shortcuts
compile command + F9
Compile selected files, packages, modules 🌟 command + shift + F9
The Debug debugging control + D

debugging

introduce shortcuts icon
The next line “do not enter method body” 🌟 F8
Next line “Enter method body” F7
Jump out of the Shift + F8
Runs to the cursor, if there are other breakpoints in front of the cursor Option + F9
Calculation expression 🌟 Option + F8
#### Practical operation
introduce shortcuts
Jump a specified row command + L
Return/advance to previous operating position 🌟 Command + option + left/right
Jump to the method/variable definition at 🌟 command + B
Select the code extraction method 🌟 command + option + M
Collapses the current code block command + -
Expands the current code block command + +
Collapse all code command + shift + +

DEBUG

  1. Breakpoint conditions: Right-click a breakpoint and enter a Condition in Condition, and the code will automatically match when the breakpoint stops at 50. Perfect for use in loop scenarios
  2. Go back to the previous step: If you miss a breakpoint when debugging a complex business, you don’t need to start from the beginning anymore.In this example, when the doubleNum method is called, click the Drop Frame button to return directly to I = 100.
  3. Multithreading debugging: When multithreading is running, it is difficult to debug because the running order cannot be controlled. Therefore, it is difficult to select a specific Thread breakpoint. The specific operation steps are similar to “1 breakpoint setting condition”, except that the Suspend option is not the default All but ThreadOnce set, you can stop at breakpoints, and you can manually switch threads yourself.
  4. Force a result return/exception thrown
  5. Remote debugging:-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=9228You need to start the application in- jar I’m just going to add this parameter to it. Essentially, it is to open the port and establish socket remote communication with the debugging end.Specific debugging only need normal debugging, of course, the test URL request address is remote.

other

bookmark

Fast start business logic artifact, for the core module of the code can be marked by bookmarking, convenient for quick positioning when needed. F3 marks bookmark, again F3 unbookmark.

Local History Version

An old programmer bug, hand shaking accidentally overwrites local code, CTRL + Z undo when you can try version of the historical version of the code restore. Right-click local history -> show history to see the previous edited historical version of the content, select the required version to restore.

Zen mode

View -> Apperence -> Enter Zen Mode Can eliminate all unnecessary interference, relative daily needs of other functions will be hidden, of course, the shortcut key can still call out the window, so this Mode is quite a test of shortcut key proficiency, of course, the appearance level in this Mode is very good. I call it the cup mode.

Inject language

When editing JSON in String objects, escape characters are often encountered, which makes it difficult to modify the content. In this case, Inject Language can be used to edit JSON

  1. The cursor selection is in quotes
  2. option + enter
  3. Select Inject Language or Reference and press EnterJSON
  4. Once again,option + enter
  5. chooseEdit JSON FragmentYou can open the edit window without the transfer character

Practical plug-in

Plug-in installation

If there are no network issues suggest Preferences – > Plugins – > MarketPlace search directly, can also be in the site search plugins.jetbrains.com/idea if the query is less than the final effect is the same.

Subject to share

Since I almost always use black themes, I only recommend black themes. After all, I have no say in using black themes. If you need a bright Theme, you can try using the Material Theme UI plug-in

  • Dark Purple Theme 🌟 🌟 🌟 🌟
  • Gradianto 🌟 🌟 🌟
  • One Dark theme 🌟 🌟 🌟

The plugin is recommended

Finally is to recommend some of my daily use frequency is relatively high, also very practical plug-ins.

The plugin name use
Alibaba Java Coding Guidelines Ali Java specification check plug-in
lombok Lombok plug-in
Rainbow brackets Rainbow parentheses, the corresponding parentheses show the same color
Material Theme UI Theme icon switch
Free Mybatis plugin Mybatis jumps from code to Mapper
leetcode editor Work fish brush algorithm
.ignore Git submits filtering files
GsonFormat Generate Java classes from JSON