如何在提交时删除 Intellij IDEA 中未使用的导入? [英] How to remove unused imports in Intellij IDEA on commit?

查看:42
本文介绍了如何在提交时删除 Intellij IDEA 中未使用的导入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在提交时删除 Intellij IDEA 中未使用的导入?

Is there a way to remove unused imports in Intellij IDEA on commit?

手动完成不是很理想,CTRL + ALT + O 有帮助,但它仍然是手动的.

It is not very optimal to do it manually, CTRL + ALT + O helps but it's still manual.

推荐答案

提交时,请勾选右侧的优化导入选项.在您更改之前,这将成为默认设置.

When you commit, tick the Optimize imports option on the right. This will become the default until you change it.

我也更喜欢使用重新格式化代码选项.

这篇关于如何在提交时删除 Intellij IDEA 中未使用的导入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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