IDEA usage tips

   

    Recently, I took out the mac at home and organized it, installed an IDEA, and learned the usage of this popular IDE tool. Preliminary experience: powerful, so powerful that you need to write an article to record the use skills, haha.

   One: Generate class annotations

       There are many online methods for this, open Preferences->File and Code Templates->Includes->File Header. Then edit the required annotation template on the right and save it. When a class is created, annotations are automatically generated.

   

 

   Two: Shortcut keys for generating method annotations.

        I am using the 2017 version. Go online to search, most of them are implemented with IDEA's Live Template. But I tried it, and it didn't work very well. Either the shortcut key can only be called inside the method, or the parameter is null. Either the parameter is there, but the parameter is displayed in the form of an array, similar to [username, password], which is not conducive to parameter description.

      In the end, I found the easiest and most common way for people who are familiar with eclipse: search for Fix doc comment in Preferences, and then give it a shortcut key. I set alt+shift+j (retaining the habit of using eclipse). The resulting method is annotated as follows,

/**
 * @param username
* @param password
* @param session
* @return
*/
public Object login(String username,String password,HttpSession session){

    return null;
}

 

  Three: automatic prompt, code completion

     Note: It is not easy to directly set the shortcut key of Cycle Expand Word in KeyMap to Alt+/.

     1: In KeyMap, remove the shortcut key of Cycle Expand Word. If it is not set by default, it does not need to be removed.

      2: Set the shortcut key of basic to Alt+/, apply---ok.

     Tested, works well.

 

   Four: Automatically prompt case closure

      Preferences---sensitive,case sensitive completion 设置为NONE,apply --ok。

 

  Five: idea copy error message

       We are used to releasing the mouse after the mouse is selected, and then CTRL+C, but the content selected by releasing the mouse in the idea is gone, even the message box is gone. Then change the habit: select with the mouse, CTRL+C, and then release the mouse.

 

   Six: The mapper.xml prompts "no data sources are configured ..." "SQL dialect is not configured. Sybase, SQL Server match best" prompts us to configure it in IDEA data source,但是目前都是用ORM框架,不会使用IDEA直接查看数据库。因此忽略此信息即可:

 Remove: no data sources are configured warning:

Preferences ⇒ Editor ⇒ Inspections ⇒ SQL ⇒ No data sources configure. Uncheck, apply--OK.

 Removed: SQL dialect is not configured warning:

  Preferences ⇒ Editor ⇒ Inspections ⇒ SQL ⇒ SQL dialect detection. Uncheck, apply--OK.

   At this point, there is still a green background color,

  Removed: "Injected Language" background color:

   Prefernces ⇒ Editor ⇒ Colors & Fonts ⇒ General ⇒ Code ⇒ Injected language fragment ⇒ Background。

  I am using 2017:

    Prefernces ⇒ Editor ⇒Color Scheme ⇒ General ⇒Code ⇒ Injected language fragment ⇒ Background,

   Remove the check, apply--OK.

 参考:http://blog.csdn.net/aubdiy/article/details/68485336

 

 

     ~~~持续更新中

 

 

 

 

 

 

 

 

  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326170043&siteId=291194637