banner
lMingyul

lMingyul

记录穿过自己的万物
jike
twitter
github
bilibili

Using the Series - Common Settings of IDEA

Article update log:
2023-08-15 Added prompt for setting Serializable interface

The Using Series records how I use software tools in my daily life. This article is part of the Using Series - Common Settings of IDEA. Due to the company's intranet environment, I find it quite good to use IDEA at work, but I cannot synchronize my settings to my home in time. Therefore, I specifically wrote this series to record the modifications I made to this commonly used IDE during my daily development programming to improve my coding efficiency and enthusiasm. This series will be continuously updated.

First, let me clarify that this article introduces IDEA version 2022.3.2 (Ultimate Edition), and the computer system is Mac OS 12.5 Monterey version.

Almost all settings of IDEA are in the detailed settings menu, and the shortcut key to open the settings menu is ⌘ + ,

CleanShot-2023-02-11-14-51-47@2x-2023-02-11-145344

Appearance#

First of all, a handy weapon should also be pleasing to the eye.

Theme#

I personally prefer to use a dark theme. After trying many themes, I still like this Xcode-Dark theme the most.

CleanShot-2023-02-11-14-57-11@2x-2023-02-11-145812

I borrowed this display image from the theme plugin's official website; this pinkish feel is still very nice.

image

Font#

For programmers, the code they write is like their business card, so a good-looking font is also very necessary.

I had been using a very nice font: JetBrains Mono, which is indeed very good-looking. Below is a display of this font's specific code.

CleanShot-2023-02-11-15-12-39@2x-2023-02-11-151316

However, I recently discovered another font that fits my aesthetic, which is Fira Code. Here is the display of the same piece of code.

CleanShot-2023-02-11-15-17-14@2x-2023-02-11-151742

Font settings are in Editor -> Font.

CleanShot-2023-02-11-15-20-40@2x-2023-02-11-152219

This mentions a setting for adjusting font size with the mouse; use Ctrl + Mouse Wheel to set the font size.

CleanShot-2023-02-11-15-51-59@2x-2023-02-11-155412 CleanShot-2023-02-11-16-04-27-2023-02-11-160636

System Settings#

Default Startup Options#

Set IDEA's settings for opening projects each time:

  • New Window
  • Current Window
  • Ask, I prefer this
CleanShot-2023-02-11-15-36-31@2x-2023-02-11-153709

Disable Automatic Updates#

There is no need to check for automatic updates for the IDEA software itself, as updating the entire software can easily introduce compatibility issues. It is recommended not to select this.

Plugin updates can be checked.

CleanShot-2023-02-11-15-45-58@2x-2023-02-11-154657

Adjust IDEA's Startup Parameters#

Make the IDE run more smoothly.

Find Help -> Edit Custom VM Options in the menu, and adjust JVM-related parameters such as -Xms and -Xmx in the opened idea.vmoptions file.

  • -Xms2048m: Specifies the initial size of the JVM heap memory.
  • -Xmx8192m: Specifies the maximum value of the JVM heap memory.
  • -XX:+UseConcMarkSweepGC: Selects the CMS garbage collector as the garbage collector when starting the Java Virtual Machine.
  • -Djava.net.preferIPv4Stack=true: Indicates that IPv4 addresses should be preferred over IPv6 addresses. This parameter is commonly used in handling network connections, as some older network devices may not support IPv6 addresses. If IPv6 addresses are used by default, it may lead to connection issues. By setting this parameter to true, it ensures that Java prioritizes using IPv4 addresses when handling network connections, thus avoiding connection issues.
  • -Dfile.encoding=UTF-8: The file encoding uses UTF-8 encoding format.

Show Line Numbers and Method Separators#

CleanShot-2023-02-11-16-10-16@2x-2023-02-11-161135

Code Intelligent Prompt Function#

Code prompts and completions have a feature: case sensitivity. It is recommended to uncheck this so that you can get code prompts regardless of whether you input uppercase or lowercase.

CleanShot-2023-02-11-16-15-45@2x-2023-02-11-161635

Set Project File Encoding to UTF-8#

Sometimes errors in the code may be caused by code encoding, so it is very necessary to unify the encoding format before project development.

CleanShot-2023-02-11-16-19-51@2x-2023-02-11-162104

Set Java File Header Comment Information#

When we create a new Java file, we inevitably need to write comments at the top of this file to explain some basic information about it, such as the creator, creation time, description, etc. However, manually entering this every time is cumbersome, so IDEA provides templates for creating files, and we can customize our own templates.

Since I am a Java developer, I only set up templates for class, interface, and Enum. The ${USER} in the comments is a preset variable, and other variables can be viewed on the official website.

CleanShot-2023-02-11-16-29-02@2x-2023-02-11-162947

Set Automatic Compilation#

The benefits of setting automatic compilation:

  • Saves time, no need for manual compilation.
  • Can promptly discover syntax errors in the code, avoiding issues when running the code.
CleanShot-2023-02-11-16-37-24@2x-2023-02-11-163847

Set Maven's Reload Operation#

When the pom.xml file changes, it will automatically trigger Maven's Reload operation.

CleanShot-2023-02-25-14-38-02@2x-2023-02-25-143856

Set Prompt for Implementing Serializable Interface#

When a class implements the Serializable interface, IDEA prompts to add serialVersionUID.

  1. Open settings.
  2. Search for serialVersionUID.
  3. Check Serializable class without "serialVersionUID".
  4. Then, place the cursor on the class that implements the Serializable interface, and press Option + Enter (Mac) / Alt + Enter (Win) to automatically add serialVersionUID.
pictures pictures

This article will continue to be updated as long as I am still using the IDEA software ♪(・ω・)ノ

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.