Is there a tool for Scala to clean all the unused imports from all the code files? [closed]

£可爱£侵袭症+ 提交于 2019-12-04 01:34:49

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

I think Intellij marks unused imports gray. I don't think there is an automatic tool yet. Eclipse's and ensime's "organize imports" refactoring doesn't remove imports. You could of course always comment out individual imports and recompile.

Scalafix has a rewrite to remove unused imports: https://scalacenter.github.io/scalafix/#RemoveUnusedImports

add addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.5.0-M1") to your project/plugins.sbt

then run sbt "scalafix RemoveUnusedImports"

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!