Webstorm incorrectly marks all imports and variables as unused
For several weeks Webstorm has been marking all imports and variables as unused in all my projects. Refactoring is also broken, i.e. if I change the name of an exported symbol using the Refactor tool, the change will not propagate to other files where that symbol is used.
In the above screenshot, the imports from @angular/core are wrongly marked as unused (this happens for all imports). Same goes for "zero" and "one" variables, which show up grey despite being used on the next line. You can access this example repository here: https://github.com/olagbk/debuginspections - but it's just a standard Angular CLI project with default configuration, and I doubt you'll be able to use it to reproduce the issue.
I have tried re-indexing, deleting .idea, invalidating caches, reinstalling Webstorm, reverting back to 2022.2 and 2021.3. I'm using node v16.18.1 and typescript 4.8.4, but I have tried other versions too. There is no relevant information in idea.log. I'm running out of things to try, and this renders the IDE almost unusable. Please advise what could be causing this problem.
请先登录再写评论。
It works fine for me using your project:
Could you check if starting the IDE with default settings (File > Manage IDE Settings > Restore Default Settings...) helps?
Wow, looks like that's the one thing I didn't try. That did the trick, do you have any idea what could have caused this though? Either way thank you so much!
Not sure.. can be a third-party plugin or overridden file type...
I have the same issue, but the support refuses to get into it until I deliver a reproducible test project. Well, it is not that easy. It is now all over the place in various typescript repositories. I will happily grant access to one of my repositories for the support to analyse it.
Now I see the suggested solution and it works. Takes some time to get personal preferences back, but this is better than those false positives. Thanks!
No!! It starts again to show unused variables that clearly are not!
Andre Michelle please could you share screenshots illustrating the issue?
We did that already months ago.
Similar issue is tracked at https://youtrack.jetbrains.com/issue/WEB-65376/Finding-usages-broken-for-Javascript-methods-starting-with. Unfortunately it's not reproducible on our end. A sample project that reproduces the issue would be appreciated.