"Field x is never used" not found from Intellij's Setting/Inspection/Java list, how to get an highlight instead of an onmouseover warning?

huangapple go评论66阅读模式
英文:

"Field x is never used" not found from Intellij's Setting/Inspection/Java list, how to get an highlight instead of an onmouseover warning?

问题

在IntelliJ中,我找不到“Field x is never used”在IntelliJ的设置/检查/Java列表中。

如何在未使用的成员字段的情况下获得系统化的高亮,而不是在鼠标悬停时出现警告?

顺便说一下,弹出窗口右上角的“Show Inspection Description”命令是灰色的。

我还将Java的“Unused declaration”检查设置为“错误”然后为“严重”状态,此时右侧滑块上会显示相应的颜色条,但编辑器中什么也没有改变...顺便说一下,颜色条会出现在未分配的成员上,这不是我想要的,因为它会出现在自动装配的Spring成员上,这不是一个错误...我需要编辑器中仅用于未使用成员的警告...

英文:

In IntelliJ, I could not find "Field x is never used" in Intellij's

> Setting/Inspection/Java

list.

How to get a systematic highlight instead of an "on mouse-over" warning in the case of unused member fields ?

By the way, the command "Show Inspection Description" available top-right of the popup is greyed-out.

"Field x is never used" not found from Intellij's Setting/Inspection/Java list, how to get an highlight instead of an onmouseover warning?

I also set Java's "Unused declaration" inspection to the "Error" then "Severe" status, the location is in thos case indicated by a corresponding color bar on the right slider, but nothing do change in the editor … incidentally, the colored bar appear for unassigned members and this is what I do not want since it happen for autowired Spring members and this is not an error ..I would need a warning in the editor just for
unused members ..

答案1

得分: 1

意图不应该被标记为灰色,那看起来像是一个错误 - 正如 @olga 已经提到的。但这并不会阻碍你实现你想要的。

所以,为了找到那个意图。去找未使用的变量,然后按下 ALT + Enter

"Field x is never used" not found from Intellij's Setting/Inspection/Java list, how to get an highlight instead of an onmouseover warning?

使用右箭头键 ->
"Field x is never used" not found from Intellij's Setting/Inspection/Java list, how to get an highlight instead of an onmouseover warning?

按下回车,你将被引导到适当的检查设置:

然后将其从 警告 改为 错误
"Field x is never used" not found from Intellij's Setting/Inspection/Java list, how to get an highlight instead of an onmouseover warning?

从现在开始,每个未使用的变量都将被标记为错误,而不是警告。

更改外观

如果你不想要一个错误标记,只想改变警告的显示方式,请执行以下操作:

前往 设置 -> 编辑器 -> 颜色方案 -> 通用
然后选择 错误和警告未使用的符号
你可以在右侧自定义外观。
"Field x is never used" not found from Intellij's Setting/Inspection/Java list, how to get an highlight instead of an onmouseover warning?

英文:

The intention shouldn't be grayed out, that looks like a bug - since @olga already mentioned. But that doesn't hinder you from achieving what you want

So, in order to find that intention. Go to the unsed variable and hit ALT + Enter:

"Field x is never used" not found from Intellij's Setting/Inspection/Java list, how to get an highlight instead of an onmouseover warning?

Use the right arror key ->
"Field x is never used" not found from Intellij's Setting/Inspection/Java list, how to get an highlight instead of an onmouseover warning?

Hit enter and you will be routed to the appropriate inspection setting:

Then change from warning to error:
"Field x is never used" not found from Intellij's Setting/Inspection/Java list, how to get an highlight instead of an onmouseover warning?

From now on every unused variable will be marked as an error instead of warning.

Change The Appearence

If you don't want to have an error mark and you just want to change how the warinig is displayed, do the following:

Go to Settings -> Editor -> Color Scheme -> General
then select Errors and Warnings and Unused symbol.
You can customize the apperance on the right side.
"Field x is never used" not found from Intellij's Setting/Inspection/Java list, how to get an highlight instead of an onmouseover warning?

答案2

得分: 0

请按照已创建的用于编辑器高亮问题的问题链接进行操作:https://youtrack.jetbrains.com/issue/IDEA-242284
以及用于“显示检查描述”的问题链接:https://youtrack.jetbrains.com/issue/IDEA-252200

英文:

Please follow the issue already created for Editor highlighting problem: https://youtrack.jetbrains.com/issue/IDEA-242284
and the issue for the "Show inspection description": https://youtrack.jetbrains.com/issue/IDEA-252200

huangapple
  • 本文由 发表于 2020年10月2日 23:20:32
  • 转载请务必保留本文链接:https://go.coder-hub.com/64174152.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定