Unused imports not highlighted

Hi,

For several versions of PyCharm now, I have noticed that the unused imports are not highlighted. Maybe I might just need to change something in the preferences. The only thing I could find in the prefs that looks like it is the "unused symbol" in the colors&fonts prefs. But as you can see in the attached screenshot, there is already a wavy yellow underlined for that one. That underline does not appear for unused Python imports though.

Am I missing something?

Many thanks,

Julien



Attachment(s):
Unused Imports.png
7 comments
Comment actions Permalink

To have unused import highlighting, you need to have the "Unresolved references" inspection enabled in Settings | Inspections.

0
Comment actions Permalink

Great, thank you!

This is often referenced as "Unused imports" so maybe it'd be good to rename the preference "Unresolved references and unused imports" or something like that, so it's easy to find.

Thank you,

Julien

0
Comment actions Permalink

Hello Julien,

Great, thank you!

This is often referenced as "Unused imports" so maybe it'd be good to

rename the preference "Unresolved references and unused imports" or

something like that, so it's easy to find.

http://youtrack.jetbrains.net/issue/PY-2111

--

Dmitry Jemerov

Development Lead

JetBrains, Inc.

http://www.jetbrains.com/

"Develop with Pleasure!"

0
Comment actions Permalink

Hi,

I have Inspect -> Unresolved References turned on, and Highlight Level is set to "All Problems", but Pycharm 2021.1 is not highlighting unused imports.  (It's also not highlighting undefined references, like variable "y" on line 7).  This worked fine in Pycharm 2020 but stopped working when I upgraded to 2021.

 

6
Comment actions Permalink

I had the same problem for the longest time. Make sure "reader mode" is disabled. I think this did it for me!

2
Comment actions Permalink

Thank you, Michal

It worked for me. It is just in the top right corner and if you click it it will disable Reader Mode and then it works.

0
Comment actions Permalink

Michal method just works. I appreciate it. 

0

Please sign in to leave a comment.