Search for commented-out code across files in Eclipse

前端 未结 6 774
难免孤独
难免孤独 2021-02-08 13:23

Is there a quick way to find all the commented-out code across Java files in Eclipse? Any option in Search, perhaps, or any add-on that can do this?

It should be able to

6条回答
  •  旧巷少年郎
    2021-02-08 14:14

    @Jorn said:

    I think [the OP] wants to find code that is commented out, not code that has a comment.

    If the intention is to find commented out code, then I don't think it is possible in general. The problem is that it is impossible to distinguish between comments that were written as code or pseudo-code, and code that is commented out. Making that distinction requires human intelligence.

    Now IDE's typically have a "toggle comments" function that comments out code in a particular way. It would be feasible to write a tool / plugin that matches the style produced by a particular IDE. But that's probably not good enough, especially since reformatting the code typically gets rid of the characteristics that made the commented out code recognizable.

提交回复
热议问题