IDEA 配置优化,提高开发效率
去掉烦人的indent提示###
如何去掉呢?
打开IDEA 的preferences|Editor|Code Style,
去掉下图中的两个勾选:
设置文件的模板###
我们创建一个java文件时,会在类的上面自动添加注释,包括作者和日期.
其实我们可以定制这个自动添加的注释:
原来是这样的:
修改为:
定制自己的snippet###
snippet就是代码片段
用过eclipse的同学都知道,我们输入Sysout就会自动转换为:
System.out.println();
其实IDEA 也有相同的功能:
添加自定义文件类型###
IDEA中没有jsp,所以我手动添加JSP:
下面附上JSP的模板:
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
if (path.equals("/")) {
path = "";
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="<%=path%>/static/css/global.css">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
content="width=device-width, initial-scale=1.0, maximum-scale=1">
<script type="text/javascript" src="http://hbjltv.com/static/js/jquery-1.11.1.js"></script>
<title>#[[$Title$]]#</title>
</head>
<body>
#[[$END$]]#
</body>
</html>
去掉框架检查提示
如何去掉框架的检查提示呢?
Code completion case sensitivity###
By default IntelliJ IDEA code completion case sensitivity only affects the first letter you type. This strategy can be changed in the Settings/Preferences dialog, Editor | General | Code Completion, so you can make to either make the IDE sensitive to all letters or make it insensitive to the case at all, based on what better fits your preferences.
改为不区分大小写:
解决mac IDEA控制台中文乱码###
解决方法:
JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
注意:下面的四个,每个都得手动设置一次:
解决之后:
参考:idea 控制台输出 中文乱码 解决方法
隐藏IDEA cast unchecked警告
未保存的文件标识出
web 项目设置标准的classes目录
如果没有专门设置过,command+;(分号) 打开配置如下:
每次设置好之后,只要pom.xml文件发生改变,配置又会还原为上图.
预期的配置(command+;查看):
需要做的设置(command+,):
标准的classes 目录如下:
/Users/whuanghkl/code/mygit/github_new/http_session_demo/src/main/webapp/WEB-INF/classes
标准的webApp目录:
/Users/whuanghkl/code/mygit/github_new/http_session_demo/src/main/webapp
注意:只有web 项目才需要这样设置,一定要去掉勾选
编译配置
解决Name for argument type [java.lang.String] not available, and parameter name information not found in class file either
-parameters 要重新编译
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<compilerVersion>${java.version}</compilerVersion>
<encoding>UTF-8</encoding>
<compilerArgument>-parameters</compilerArgument>
</configuration>
</plugin>
编辑器配置
快捷键
Tabnine 代码AI工具
解决复制时,自动选中整行的问题
现象
原因
https://www.coder.work/article/6502138
当没有选中任何内容时,command+C 自动复制整行内容
解决方法
勾选:editor.skip.copy.and.cut.for.empty.selection
快速编译
推荐软件
- PopClip
- Typinator