【发布时间】:2020-07-21 08:50:35
【问题描述】:
有没有办法为所有项目即时优化导入,而不仅仅是 Android Studio/IntelliJ 中的“当前项目”?
预期
优化导入以在打开现有项目和/或创建新项目时启用。
观察到
Add unambiguous imports on the fly 是 IDE 级别的设置。但是,Optimize imports on the fly 似乎不是括号状态for current project。我通过创建一个新项目并打开设置对此进行了测试。正如预期的那样,Add unambiguous imports on the fly 被选中,而 Optimize imports on the fly 未被选中。
当前的 IntelliJ 文档 Auto imports 没有提供解决方案。
尝试的解决方案
在新项目首选项下启用Optimize imports on the fly (for current project)...
这产生了与上述相同的观察结果。
这也已添加到IntelliJ community forum。
【问题讨论】:
-
你如何定义“所有项目”?
-
期望的目标以及我所说的“所有项目”是在打开现有项目或创建新项目时将其作为默认设置。
-
那么看起来检查该复选框就是您想要的。您正在查看 IDE 级别的设置,而不是特定于项目的设置。
-
Add unambiguous imports on the fly是 IDE 级别的设置。但是,Optimize imports on the fly似乎不是括号状态for current project。我通过创建一个新项目并打开设置对此进行了测试。正如预期的那样,Add unambiguous imports on the fly被选中,而Optimize imports on the fly未被选中。 -
好吧,这是一个很奇怪的设置 UI 设计。
标签: java android android-studio kotlin intellij-idea