IntelliJ在整个文件中应用检查修复 [英] IntelliJ apply inspection fix throughout entire file

查看:95
本文介绍了IntelliJ在整个文件中应用检查修复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在IntelliJ中,我进行了检查以检查是否可以打开final的变量,以便IntelliJ突出显示这些变量,并让我快速使用 Alt +添加final关键字输入.

In IntelliJ, I have the inspection that checks for variables that can be made final turned on so that IntelliJ will highlight those variables and let me quickly add the final keyword with Alt + Enter.

当我打开通常不使用final关键字的其他人的代码时,我想要一种快速的方法将final添加到整个文件甚至整个项目的所有变量中,如果可能的.

When I open up someone else's code who does not typically use the final keyword, I would like a quick way to add final to all variables that can be throughout the entire file, or even the entire project, if possible.

在IntelliJ中是否有任何快捷方式或其他方法可以轻松地做到这一点?

Is there any shortcut or some other way to do this easily in IntelliJ?

推荐答案

感谢您从该帖子:

将鼠标悬停在一个可以设置为final的变量上时,可以使用典型的 Alt + Enter 快捷方式在当前文件中实现此功能,然后按,然后选择修复文件中的所有'局部变量或参数可能是最终的'问题".

You can achieve this in the current file using the typical Alt + Enter shortcut when hovering over one such variable that can be made final, press , and select "Fix all 'Local variable or parameter can be final' problems in file".

该子菜单中的下一项是对...运行检查",它将使您可以将修复程序应用于项目中的多个文件.

The next item down in that sub-menu is "Run inspection on ...", which will allow you to apply the fix to multiple files in your project.

这篇关于IntelliJ在整个文件中应用检查修复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆