Unused Symbol Detection

Unused Symbols

Invariably asĀ  code evolves, some lonely unused definitions are are left around. To help you find and eradicate these, IDEA now highlights unused vals, vars, and defs.

You can use the quick fix to delete the unused symbol.

Needless Vars

Similarly, IDEA highlights needless vars, that is, ones that are never assigned to, with a quick fix to convert it to a val.

Limitations

Currently this reference checking is not enabled for cross-file references, you still need to use Find Usages for these. This means that only locals and private class members are highlighted.

It is also disabled for implicit members, and for methods with special names (apply/unapply/update/map/flatMap/filter/withFilter/foreach), for which the reference checking is not yet comprehensive.

This entry was posted in Uncategorized. Bookmark the permalink.

3 Responses to Unused Symbol Detection

  1. Alain O'Dea says:

    I am a heavy user of similar functionality in IntelliJ’s Java support and already enjoy the identfication of unnecessary vars.

    I am looking forward to putting this into action in cleaning up my code :)

  2. Jonathan Toland says:

    Just wanted to say great work and thx for keeping us in the loop on incoming features!!

  3. Lurline says:

    Thank you for making the effort to explain the terminlogy to the rookies!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>