Skip to content

Highlight unused symbols #15710

Closed
Closed

Description

I'd like to request an improvement to Typescript support: highlighting of unused symbols.

Refactoring and moving things around between files often leads to a lot of manual analysis, for example to find imports that are no longer in use.

This doesn't need to be a big, complex feature - I don't expect this to trawl through the entire codebase and figure out what is or isn't in use.

I'd be happy with just file-local highlighting - e.g. gray out variable and constant declarations if they aren't exported or used in any expression or statement anywhere in the file.

Activity

  1. mindplay-dk commented on Nov 18, 2016

    @mindplay-dk
    Author

    If possible, in addition, a right-click option to clean up unused symbols would be useful :-)

  2. waderyan commented on Nov 22, 2016

    @waderyan

    Thank you for your feature request! We have discussed this internally and have considered adding it soon.

  3. changed the title [-]Typescript, feature: highlight unused symbols[/-] [+]Highlight unused symbols[/+] on Nov 22, 2016
  4. jschlieber commented on Feb 3, 2017

    @jschlieber

    Webstorm has it and it is really really handy! Would love to have it in VSCode for TypeScript and JavaScript.

  5. mjbvz commented on Feb 11, 2017

    @mjbvz
    Contributor

    Related API request #20219

  6. mjbvz commented on Apr 3, 2017

    @mjbvz
    Contributor

    #23805 Notes that we could also investigating graying out unreachable code

  7. PDS42 commented on Jun 22, 2017

    @PDS42

    Sorry if that's not the right place to ask this, but is this being implemented anytime soon (local unused variables)? It would be a huge improvement IMO. This is the only reason that makes me consider switching to WebStorm, though I really enjoy VS!

  8. mindplay-dk commented on Jun 23, 2017

    @mindplay-dk
    Author

    Storm is generally awful at Typescript, but yes, I occasionally find myself opening Storm just to check for unused symbols. Would be great to have this.

  9. 16 remaining items

  10. mjbvz commented on Mar 23, 2018

    @mjbvz
    Contributor

    Depends on microsoft/TypeScript#22361

    As already noted, you can already enable this using settings in your jsconfig / tsconfig. This issue specifically is now tracking:

    • Allowing this you to see unused symbols even when you don't have a jsconfig or tsconfig and have not configured these settings

    • Possibly presenting unused symbols in a different way. Graying out these symbols is one idea

  11. added a commit that references this issue on May 10, 2018
    cc1a5a4
  12. added a commit that references this issue on May 17, 2018
    9ed74df
  13. added a commit that references this issue on May 17, 2018
    8bb27cd
  14. carpet92 commented on Jun 24, 2018

    @carpet92

    Is this works only for JavaScript and TypeScript?

  15. locked and limited conversation to collaborators on Jul 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions