Closed intgr closed 2 years ago
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:
Inspections from ExternalAnnotator now look different
What does it mean that they look different? Because of the different severity levels?
In the "Problems" window, mypy inspections can no longer be grouped by inspection type -- they always appear at the root level.
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: is something else missing?
Some screenshots to illustrate the differences:
In the "Problems" window, mypy inspections can no longer be grouped by inspection type -- they always appear at the root level.
Before | After |
---|---|
Inspections from ExternalAnnotator now look different What does it mean that they look different? Because of the different severity levels?
Yeah, the styles associated with the new severity levels are different.
Before | After |
---|---|
Finally, I saw that this is not checked: [...] is something else missing?
Not that I know of. I just want to do some additional testing and review myself before I'm confident in this.
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: (noinspection
comment ignored)
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 # type: ignore
comments instead.
There's also this from comment from JetBrains developers: https://intellij-support.jetbrains.com/hc/en-us/community/posts/115000691050/comments/115000579464
we think of inspections as something which can be disabled, annotations - something which can't, something like compiler errors.
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. :)
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
# type: ignore
comments instead.
Yeah this is not be best but, as you said, would be better to use the mypy ignore comments.
Other than the shortcomings I pointed out in comments and bikeshedding about severity levels, this PR is ready.
# noinspection Mypy
comments no longer suppress the annotations.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 # type: ignore
comments. If it's not done by tomorrow, it's probably worth releasing without it.
Hi @intgr, unfortunately the review process failed due to this error:
This AnnotationBuilder
class seems to not be available on any version prior 2020.1.4:
Shall we just drop those version and change the sinceBuild
to 201.8743
or do you have any other suggestion?
Hi! There was an alternative API AnnotationHolder.createAnnotation
(instead of newAnnotation()
). But that one was marked deprecated.
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 :+1:
Version 0.12.1 is out :tada: https://plugins.jetbrains.com/plugin/11086-mypy/versions/stable/148936
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 :(
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
Fixes #1234
syntaxDescription
Type of Changes
Related Issue
Closes #43