IDEA安装后常用配置

IDEA已经用了很长时间,经常在切换版本或重装后做一些配置,现在记录下认为比较实用的配置。

文中使用的IDEA2019.2

目录

安装插件

修改快捷键

增加字段注释

取消idea双击shift时出现的全局搜索

增加类注释

增加方法注释

增加获取当前日期和时间的快捷操作

自动生成测试类的插件


安装插件

JUnitGenerator V2.0

CodeGlance

Lombok

Maven Helper

Rainbow Brackets

Alibaba Java Coding Guidelines

修改快捷键

  • 增加字段注释

用于增加字段注释 Alt+D

 

  • 取消idea双击shift时出现的全局搜索

https://blog.csdn.net/hxy199421/article/details/83030603

CTRL+shift +A

  • 增加类注释

/**
*
* @description: ${description}
*
* @author: zhangzb10
*
* @create: ${YEAR}-${MONTH}-${DAY} ${HOUR}:${MINUTE}
**/
  • 增加方法注释

** 
* @description $description$ 
* @author zhangzb10
* @create $date$ $time$
*/

使用时在方法上输入 "/fun" 然后按tab间即可

  • 增加获取当前日期和时间的快捷操作

$date$ $time$

使用时输入 "dt" 然后按tab 

  • 自动生成测试类的插件

JUnitGenerator V2.0

${SOURCEPATH}/../../test/java/${PACKAGE}/${FILENAME}

######################################################################################## 
## 
## Available variables: 
##         $entryList.methodList - List of method composites 
##         $entryList.privateMethodList - List of private method composites 
##         $entryList.fieldList - ArrayList of class scope field names 
##         $entryList.className - class name 
##         $entryList.packageName - package name 
##         $today - Todays date in MM/dd/yyyy format 
## 
##            MethodComposite variables: 
##                $method.name - Method Name 
##                $method.signature - Full method signature in String form 
##                $method.reflectionCode - list of strings representing commented out reflection code to access method (Private Methods) 
##                $method.paramNames - List of Strings representing the method's parameters' names 
##                $method.paramClasses - List of Strings representing the method's parameters' classes 
## 
## You can configure the output class name using "testClass" variable below. 
## Here are some examples: 
## Test${entry.ClassName} - will produce TestSomeClass 
## ${entry.className}Test - will produce SomeClassTest 
## 
######################################################################################## 
## 
#macro (cap $strIn)$strIn.valueOf($strIn.charAt(0)).toUpperCase()$strIn.substring(1)#end 
## Iterate through the list and generate testcase for every entry. 
#foreach ($entry in $entryList) 
#set( $testClass="${entry.className}Test") 
## 
package $entry.packageName; 

import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.core.io.ClassPathResource;
import org.springframework.test.context.junit4.SpringRunner;

/** 
* ${entry.className} Tester. 
* 
* @author zhangzb10
* @version 1.0 
*/ 

@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class $testClass { 

#foreach($method in $entry.methodList) 
    @Test
    public void test#cap(${method.name})() throws Exception { 
    
    } 

#end 

#foreach($method in $entry.privateMethodList) 
    @Test
    public void test#cap(${method.name})() throws Exception { 
    #foreach($string in $method.reflectionCode) 
        $string 
    #end 
    } 

#end 
} 
#end

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值