当前位置:网站首页>>>开发工具:IDEA格式化代码无效
>>开发工具:IDEA格式化代码无效
2022-08-11 05:22:00 【六月暴雪飞梨花】
IDEA是一个很好使用的工具,在日常开发中经常使用,快捷键也是一个很好的节约开发时间的工具,在日常开发中也经常使用。如果快捷键假性失灵,不仅仅影响开发心情,也让有强迫症的人看着不舒服。我这里出现的情况虽然快捷键也可以使用,但是格式后的位数不是以前的默认的那种。
1、假性失灵后的效果
失灵后的快捷键格式化代码(快捷键:option(⌥) + command(⌘) + L)
public class Test02 {
public final int value = 4;
public void doIt() {
final int value = 6;
new Runnable() {
final int value = 5;
@Override
public void run() {
final int value = 10;
System.out.println(this.value);
}
}.run();
}
public static void main(String[] args) {
Test02 test02 = new Test02();
test02.doIt();
}
}
使用的默认的配置(在Settings/Preferences对话框中,Editor > Code Style > Java 中配置Tabs and Indents),如图:
2、实际想要的效果
实际想要的还原的默认的效果:
public class Test02 {
public final int value = 4;
public void doIt() {
final int value = 6;
new Runnable() {
final int value = 5;
@Override
public void run() {
final int value = 10;
System.out.println(this.value);
}
}.run();
}
public static void main(String[] args) {
Test02 test02 = new Test02();
test02.doIt();
}
}
3、解决方案
按照官网说的的设置了几次,也百度了几次,始终没有找到想要的效果。本想着应该可以还原这些配置,就找了下如何还原这个配置,功夫不负有心人,在一篇其他文章找到了还原方法,具体还原方式如下:
路径:File > Manage IDE Settings > Restore Default Settings...,点击一下就还原到默认的设置,但是其他的一些设置也会被还原,需要重新设置一下。
备注:IDEA版本:IntelliJ IDEA 2021.3.3 (Ultimate Edition)
边栏推荐
猜你喜欢
随机推荐
windows下的redis安装及密码修改
Install different versions of MinGW (g++/gcc) and the configuration of the corresponding clion editor under Win
BoredApeYachtClub 无聊猿-NFT 源码解析第一节
代币标准--ERC721协议源码解析
解读String的intern()
Haproxy集群
06-引入Express创建web服务器、接口封装并使用postman测试,静态资源托管
mysq基础语句+高级操作(学这篇就够了)
《现代密码学》学习笔记——第三章 分组密码
xss.haozi靶场通关
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
gradle-wrapper.jar description
C language - program compilation and execution, detailed macro definition
OSPF综合实验
工具窗口永远置顶
GBase 8s的分片和索引
如何正确使用OPcache优化系统性能
ES6 迭代器与生成器
ES6-class类
[C language from elementary to advanced] Part 1 Initial C language (1)






![《现代密码学》学习笔记——第七章 密钥管理[二]数字证书](/img/d9/e101988bd8d16fb5afafd45e97edc7.png)


