-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve performance, convert real-time scanning to ExternalAnnotator API #77
Improve performance, convert real-time scanning to ExternalAnnotator API #77
Conversation
Oh wow this seems really interesting! Today I can't check it but I'll try to do it tomorrow, thanks a lot! |
Hi @intgr, I tested your branch and it seems to work fine! I have some questions:
What does it mean that they look different? Because of the different severity levels?
I also don't get this: form what I saw the "Problems" window before and after your changes looks the same, beside the different severity level (at least with the project I'm testing): Where can I find this "grooping by inspection type" that you say is not available anymore? Finally, I saw that this is not checked: |
Oh one more thing, the intention actions to suppress Mypy errors, disable inspection etc, is no longer available, and PyCharm suppression syntax is ignored. Before: (this option is no longer available) After: ( I haven't checked how difficult it would be to add back support for this. I guess there are some users relying on this feature. What do you think? Although it would be better to generate the mypy-native |
There's also this from comment from JetBrains developers: https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000691050/comments/115000579464
Considering that, the LocalInspectionTool API sounds like a better fit in theory. But fixing the performance issues I think outweighs any argument from purism. Even JetBrains keeps breaking this rule with PEP 8 and TypeScript inspections. I think it's just bad design to have so different APIs for this similar functionality. I have lots of other gripes about the API design as well, but there's nothing we can do about it really. :) |
Yeah this is not be best but, as you said, would be better to use the mypy ignore comments. |
public HighlightSeverity getHighlightSeverity() { | ||
switch (severityLevel) { | ||
case ERROR: | ||
return HighlightSeverity.ERROR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't realize this before, but I could switch all inspections to HighlightSeverity.WARNING
to retain the previous style (yellow background).
But I've grown to like the red squiggly underline look. It's also familiar to users of IDEA TypeScript integration. I'd keep it HighlightSeverity.ERROR
personally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1b72306
to
ce8e226
Compare
Using the `ExternalAnnotator` API (instead of `LocalInspectionTool`) behaves a lot better with slow scanners like mypy and fixes reported performance problems with the plugin (fixes leinardi#43). Following multiple successive changes to a file, `LocalInspectionTool` can invoke the checker for each modification from multiple threads in parallel, which can bog down the system. `ExternalAnnotator` cancels the previous running check (if any) before running the next one. Modeled after `com.jetbrains.python.validation.Pep8ExternalAnnotator`
0df2c86
to
27ec03c
Compare
Other than the shortcomings I pointed out in comments and bikeshedding about severity levels, this PR is ready.
|
Nice! Would it be OK for you if I add you to the Acknowledge section and to the changelog for your contribution to the project? |
Yes of course. Thanks :) |
And do you think a new release can already be made or do you have other changes you want to submit before the next release? |
I'm looking into how difficult it would be to create an intention for generating |
Hi @intgr, unfortunately the review process failed due to this error: Shall we just drop those version and change the |
Hi! There was an alternative API But I don't think it's common for people to use IDEs that are more than a year old. Personally I wouldn't bother with compatibility. |
Yeah, CheckstyleIDEA is also supporting only recent IDE versions: https://github.com/jshiell/checkstyle-idea/blob/main/src/main/resources/META-INF/plugin.xml#L19 I'll drop everything pre 2020 👍 |
Version 0.12.1 is out 🎉 |
Cool, thanks! Unfortunately because the 0.12.0 version is hidden, the original release notes aren't visible there. :) |
Oh that's a shame, I never had a plugin rejection before so I was not aware of this, sorry :( |
This was briefly discussed in #77 (comment) but reverted from that MR. I have found that separating mypy inspections from PyCharm's own type checker is helpful, because PyCharm is more prone to false positives. It's also familiar to users of IDEA TypeScript integration.
This was briefly discussed in leinardi#77 (comment) but reverted from that MR. I have found that separating mypy inspections from PyCharm's own type checker is helpful, because PyCharm is more prone to false positives. It's also familiar to users of IDEA TypeScript integration.
This was briefly discussed in leinardi/mypy-pycharm#77 (comment) but reverted from that MR. I have found that separating mypy inspections from PyCharm's own type checker is helpful, because PyCharm is more prone to false positives. It's also familiar to users of IDEA TypeScript integration.
Using the
ExternalAnnotator
API (instead ofLocalInspectionTool
) behaves a lot better with slow scanners like mypy and fixes reported performance problems with the plugin (fixes #43).Following multiple successive changes to a file,
LocalInspectionTool
can invoke the checker for each modification from multiple threads in parallel, which can bog down the system.ExternalAnnotator
cancels the previous running check (if any) before running the next one.Modeled after
com.jetbrains.python.validation.Pep8ExternalAnnotator
A few notes:
Inspections fromExternalAnnotator
now look different.Now using different HighlightSeverity levels instead of always a single one.# noinspection Mypy
comments no longer suppress the annotations.Contributor checklist
using the
Fixes #1234
syntaxDescription
Type of Changes
Related Issue
Closes #43