问题描述
IntelliJ 2017 有一个很好的功能,它使用方法声明中的变量名称标记正在传递的参数/参数.但 IntelliJ 似乎只对文本 (String
) 参数执行此操作.
IntelliJ 2017 has a nice feature where it labels the arguments/parameters being passed using the variable’s name from the method declaration. But IntelliJ seems to do this only for textual (String
) arguments.
在这个例子中,注意第一个参数是如何未标记的(一对 Instant
对象和一个 UUID
),而第四个 &字符串文字的第 5 个参数标记为 summary:
&详情:
.
In this example, notice how the first there arguments go unlabeled ( a pair Instant
objects and a UUID
), while the 4th & 5th arguments of String literals are labeled summary:
& detail:
.
➠ 为什么只有一些参数而不是所有参数?这个逻辑让我无法理解.
➠ Why only some arguments rather than all arguments? The logic escapes me.
➠ 有没有办法让 IntelliJ 显示所有参数的标签?
➠ Is there someway to make IntelliJ display labels for all the arguments?
推荐答案
参数提示可在 Settings
(Mac 上的 Preferences
)中配置 |编辑器
|通用
|Appearance
, 显示参数名称提示 -> 配置:
Parameter hints are configurable in Settings
(Preferences
on Mac) | Editor
| General
| Appearance
, Show parameter name hints -> Configure:
它们被故意禁用用于一些只会污染编辑器的基本方法(如 getter、setter、equals、打印和日志记录):
They are intentionally disabled for some basic methods where they will only pollute the editor (like getters, setters, equals, printing and logging):
对于您的具体情况,请启用在具有相同类型的多个参数的情况下显示非文字选项.
For your specific case enable the Show for non-literals in case of multiple params with the same type option.
这篇关于使 IntelliJ 标记所有参数,而不仅仅是字符串参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!