Closed intgr closed 2 years ago
Hot-reloading sometimes works, but other times causes errors. Haven't figured out what is causing this.
Sigh. After spending hours on this (even before creating this PR), trying out lots of things, many dead ends, I'm finally closer to understanding this. Just writing down notes for myself for future reference.
buildSearchableOptions.enabled = false
needs to be added (https://github.com/JetBrains/gradle-intellij-plugin/blob/master/FAQ.md#how-to-disable-building-searchable-options)systemProperties.put("ide.plugins.snapshot.on.unload.fail", "true")
in runIde {}
org.gradle.jvmargs=-XX:+UnlockDiagnosticVMOptions
Plugin com.leinardi.pycharm.mypy is not unload-safe because class loader cannot be unloaded.
2022-02-19 17:26:49,160 [ 113120] INFO - lij.ide.plugins.DynamicPlugins - Snapshot analysis result: Root 1:
ROOT: Global JNI
[...]
com.intellij.openapi.util.Pair.first
com.intellij.codeInsight.daemon.impl.HighlightInfo$IntentionActionDescriptor.myAction
com.leinardi.pycharm.mypy.intentions.TypeIgnoreIntention.<class> <-- smoking gun?
com.leinardi.pycharm.mypy.intentions.TypeIgnoreIntention.<loader> <-- smoking gun?
* com.intellij.ide.plugins.cl.PluginClassLoader
Looks like hot-reload works as long as:
:facepalm: I'm glad this is cleared up now. Seems like something IntelliJ should fix upstream.
Snapshot analysis outputs for the two cases:
Reported bugs to IntelliJ: https://youtrack.jetbrains.com/issue/IDEA-289241 https://youtrack.jetbrains.com/issue/IDEA-289243
Thanks a lot for the investigation and for opening the bug reports upstream! I voted and started watching both of them.
BTW, let me know when you think there are enough changes to publish a new release :+1:
I've tested this thoroughly enough that I think this can be merged.
The dynamic unloading issues in IntelliJ aren't blockers for this: in the worst case, the user receives a message that they have to restart the IDE to reload the plugin. Which was the norm previously.
When it does work, it saves a significant amount of time during development and updating.
@intgr I tested locally your changes and everything seems to work fine for me! I just submitted a new release with all your changes: https://github.com/leinardi/mypy-pycharm/releases
Thanks a lot for all the help and effort you are putting in!
BTW, not sure if you noticed or if I already told you but this plugin code is heavily inspired by Checkstyle-IDEA: I basically forked that project and adapted it to run Mypy. If you are looking for inspiration or if you want to check if there are some interesting changes that we could backport I suggest to take a look at their commit log: https://github.com/jshiell/checkstyle-idea/commits/main
Contributor checklist
master
branch (and not therelease
branch)Fixes #1234
syntaxDescription
This allows the plugin to be (re)loaded without restarting the IDE, which is useful when developing the plugin and more convenient when upgrading.
There appear to be some issues in IntelliJ IDEA with dynamic unloading (IDEA-289241, IDEA-289243), but in the worst case, the user receives a message that they have to restart IDE to reload. Which was the norm previously.
Docs: https://plugins.jetbrains.com/docs/intellij/dynamic-plugins.html
Type of Changes