Optimize import deletes necessary imports on 2016.1

Build PS-145.258

All the imports where the Class name is the same of the latest part of the namespace are marked as unused.


namespace App;
use Symfony\Component\HttpFoundation\File\File; // Import '...' is never used.
new File('/');

When running "Reformat" with "Optimize import" the File import is indeed removed. I didn't realize it until it broke in production :(



Hi there,

Please try it with the latest EAP build of 2016.1.1 -- maybe it's fixed there (if it's a known issue)


If still nothing -- please disable all 3rd party (not bundled by default) plugins and try "File | Invalidate Caches..." and restart IDE.

The only closely related issue I have found is https://youtrack.jetbrains.com/issue/WI-31636 .. but it has different setup .. so may not be related to yours.



Is the import marked as not used (grey color, underline)?

We already have a related request submitted to our tracker here: <https://youtrack.jetbrains.com/issue/WI-30219>. Please vote for it in order to move it up in the queue and receive notifications regarding the progress of the feature. See more information on working with tracker at <https://intellij-support.jetbrains.com/entries/23368682>.


Please sign in to leave a comment.