How to remove unused imports from Eclipse

前端 未结 10 1088
不思量自难忘°
不思量自难忘° 2020-12-12 10:57

Is there any way to automatically remove all unused imports (signaled with a warning) of a project with Eclipse IDE?

相关标签:
10条回答
  • 2020-12-12 11:37

    Certainly in Eclipse indigo, a yellow line appears under unused imports. If you hover over that, there will be multiple links; one of which will say "Remove unused import". Click that.

    If you have multiple unused imports, just hover over one and there will be a link that allows you to remove all unused imports at once. I can't remember the exact wording off hand, but all the links that appear are pretty self explanatory.

    0 讨论(0)
  • 2020-12-12 11:39

    press Ctrl+Shift+O and it will remove unwanted imports

    0 讨论(0)
  • 2020-12-12 11:44

    Use ALT + CTRL + O. It will organize all the imports. You can find various other options in the "Code" Menu.

    EDIT: Sorry it is CTRL + SHIFT + O

    0 讨论(0)
  • 2020-12-12 11:44

    Not to reorganize imports (not to unfold .* and not to reorder lines) to have least VCS changeset
    you can use custom eclipse clenup as this answer suggests

    0 讨论(0)
提交回复
热议问题