Code inspection does not refresh on edit

Answered

Hi, since I upgraded to PyCharm 2016.1, the code inspection triggers any errors on code changes but does not clear the error highlight on edit. Once the code inspection finds an error, even if I correct the error/typo in the editor it still thinks there is an error. The error messages still refer to the old version of the code. I tried invalidating the cache but that did not help. Once I set the "Highlighing Level" to "None" and then back to "Inspections", the errors go away.

I am currently using:

PyCharm Community Edition 2016.1.2
Build #PC-145.844, built on April 8, 2016
JRE: 1.8.0_45-b14 amd64
JVM: Java HotSpot(TM) 64-Bit Server VM by Oracle Corporation
Thanks
-Selim

 

16 comments
Comment actions Permalink

Also just to add, this happens in one particular project. The code completion in other projects seems to work fine.

0
Comment actions Permalink

Same here, I have it in all projects though. If I cut and paste the code the introspection is reevaluated.

1
Comment actions Permalink

Hi Mkrens! Could you please create a ticket in our bug tracker and attach idea.log file from Help | Show Log in ... there?

1
Comment actions Permalink

Same issue here! I have to click on customize highlighting level and change it to syntax level, then back to inspections to make it refresh.

0
Comment actions Permalink

I had the same issue with the code inspection not updating, and at least in this case was able to fix it.   By trial and error and cutting sections out of the code I found that this snippet caused the issue everywhere before and after it in a 3000 line Python file.      

Here is the Bad snippet of code: 

import re   

s1 = re.search(r'(?i)p|\*', col1)    #   Which looks for an  asterisk or a p in the col1 string.  The asterisk is escaped with \

The issue goes away after removing the "\*"   or replacing above with:

pat = r'(?i)p|\*'
s1 = re.search(pat, col1)

 

Version below:

PyCharm 2017.3.2 (Community Edition)
Build #PC-173.4127.16, built on December 18, 2017
JRE: 1.8.0_152-release-1024-b8 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Linux 2.6.32-642.6.2.el6.x86_64

 

1
Comment actions Permalink

Thank you for the comment Gghaibeh! This is, in fact, a different issue, I created a ticket for it: PY-28845.

0
Comment actions Permalink

Looks like this is still an issue for me with PyCharm 2018.1. Having to cut the affected code and paste it back to make errors/warnings go away.

0
Comment actions Permalink

I also still have this problem. Sometimes, however, it does update when you wait long enough. Might also just be a performance problem. Or there is an error that makes it slow.

0
Comment actions Permalink

I'm having this same problem across all projects:

 

PyCharm 2018.1.4 (Professional Edition)
Build #PY-181.5087.37, built on May 24, 2018

JRE: 1.8.0_152-release-1136-b39 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.5

0
Comment actions Permalink

I'm having this same problem...

PyCharm 2018.1.4 (Community Edition)
Build #PC-181.5087.37, built on May 24, 2018
JRE: 1.8.0_152-release-1136-b39 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0

How can solve it?

0
Comment actions Permalink

The same for me, it is very annoying, I always need to cut/paste lines to refresh state, please fix it

0
Comment actions Permalink

Hi Nikolay, could you please create a ticket in our bug tracker and attach idea.log from Help | Show Log in ...?

0
Comment actions Permalink

Hi All, I think I'm hitting the same problem. Memory and CPU are not struggling and cut+undo seems to take care of it right away.

Has anyone opened an issue for this yet?

Thanks!

-Jon

 

0
Comment actions Permalink

Hi Jon,

If you cannot find the issue, then you can always create your own and we will just set it as a duplicate if there is already such issue.

But please do not forget to attach idea.log from Help | Show Log in ... to it.

0
Comment actions Permalink

For a quick fix, as alluded to by OP:

  • Open the "Highlighting Level" tooltip: Code > Configure Current File Analysis... (default shortcut is Ctrl+Alt+Shift+H)
  • Set the cursor to "None" then back to "Inspections" (closing and reopening the tooltip in-between)
0

Please sign in to leave a comment.