Scala是否有工具从所有代码文件中清除所有未使用的导入? [英] Is there a tool for Scala to clean all the unused imports from all the code files?

查看:71
本文介绍了Scala是否有工具从所有代码文件中清除所有未使用的导入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我相信我的源代码文件具有许多未在代码中使用的导入功能(因为我有将它们从现有文件复制到新文件的习惯)。在Visual Studio中编码C#时(或者它的附加功能),只需单击即可擦除所有未使用的导入。是否有用于Scala的类似工具?如果我可以将其指向我的sources目录,它将清除其中的所有文件及其所有子目录和子目录(等),那将很酷。

I believe my source code files feature many imports that are not used in the code (as I have a bad habit of copying them from existing to new files). When coding C# in Visual Studio (or, maybe, it's a feature of an add-on of it) one can wipe out all the unused imports in just a click. Is there an analogous tool for Scala? Would be cool if I could just point it to my sources directory and it would clean all the files inside it and all its subdirs and subdirs of them (etc).

推荐答案

IntelliJ可以自动清理整个目录,而不仅仅是突出显示它们。快捷方式是 Ctrl + Alt + O

IntelliJ can automatically clean up imports, not just highlight them, and for the whole directory. The shortcut is Ctrl + Alt + O.

这篇关于Scala是否有工具从所有代码文件中清除所有未使用的导入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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