Code inspection does not refresh on edit

已回答

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

 

11

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

0

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

3

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

3
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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

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

0
Avatar
Permanently deleted user

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.

1

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
Avatar
Permanently deleted user

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
Avatar
Permanently deleted user

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

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

2

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

0
Avatar
Permanently deleted user

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

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
Avatar
Permanently deleted user

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)
5

I still have this problem too. The tickets seems to have timed out. Any progress on this issue?

 

p.s. I don't want to disable all my plug-ins. That is not really an optimal solution.

0

Hello @Marcus Baker

 

Please submit a ticket here https://youtrack.jetbrains.com/issues/PY  with an attached screencast of the behavior and

folder zipped from ***Help | Collect logs and Diagnostic Data*** .

 

Custom plugins are third-party software and regrettably, we have no ability to track its affection that is why it is highly recommended to disable it as the first step of the investigation. 

0
Avatar
Permanently deleted user

2020.3 on mac, started seeing this behavior too. cut and paste indeed helps.

0

Hello, 

There is an existing issue, please take a look https://youtrack.jetbrains.com/issue/PY-45776 fix will be released soon. If it is not the case, please

upload your logs folder zipped from ***Help | Collect logs and Diagnostic Data***   to the FTP

https://uploads.jetbrains.com/ and please let me know the filename. 

0

Unfortunately this problem is happening again on 2021.2 ....

7

João Trevizoli Esteves

This is probably not the same issue, could you please submit a bug report to https://youtrack.jetbrains.com/issues/py ?

0

I'm encountering this problem too, in 2021.2, as reported by João.

In the event log, there was a complaint about an incompatible plugin (Tezos), so I disabled it (but kept it installed), then restarted through the «Invalidate and Restart» command. I closed some other windows too and it's resolved now. My suspicion is that the plugin incompatibility must've been causing side effects.

2

I just hit this issue again in 2022.2.2 (Professional Edition)

0

I'm also getting this again on 2022.2.2 (Community Edition)

0

Hi Zacpjohnston, Garrickw,

Please, create separate issues on our bug tracker and attach idea.log from Help | Show Log in .... The thread is quite old and probably the original problem already fixed and unrelated.

0

I had this in version 2023.2.1

I deleted the .idea folder inside my project (created with a previous pycharm version)  and opened the project again; issue was fixed.

0

I am still seeing this problem in 2023.2.1. Changing my code triggers an error, removing the code does not get rid of the errors, se attached image. I have to remove the code line or restart PyCharm to fix it.

The problem also seem to be limited to one file at a time, meaning in the same PyCharm instans i see the problem for one file, but when i edit in another file, code errors do dissapear when corrected.

Deleting .idea folder did not help.

Created an issue and linked to this comment: https://youtrack.jetbrains.com/issue/WEB-63138/Code-inspection-does-not-refresh-on-edit

Upload id: 2023_09_24_ZfkrV1jT2WvMgZgLrNKDRD (file: idea.log)

1

GUYS! I SOLVED IT! You just need to go to File > setting > project:python-workspace(under"version control"),

 then set your Project Interpreter from None to your current Python version,

 and that will solve the case!

 

0

Molliojing 's solution does not work for me. I have the project interpreter set and still have this bug.

0

请先登录再写评论。