Why injectionConfig will fail when my plugin uninstall and then reinstall?
Answered
When I uninstall my plugin and then reinstall, injectionConfig fail even though restart, I need to restart again and it working, I cannot find the reason.
<extensions defaultExtensionNs="org.intellij.intelliLang">
<injectionConfig id="sqlInBaki" config="rabbit-sql-injections.xml"/>
</extensions>
rabbit-sql-injections.xml
<?xml version="1.0" encoding="UTF-8" ?>
<component name="LanguageInjectionConfiguration">
<injection language="SQL" injector-id="java">
<display-name>Baki (com.github.chengyuxing.sql.Baki)</display-name>
<ignore-pattern><![CDATA[^&[\s\S]+]]></ignore-pattern>
<place><![CDATA[
psiParameter()
.ofMethod(0, psiMethod().withName("query")
.withParameters("java.lang.String")
.definedInClass("com.github.chengyuxing.sql.Baki"))
]]></place>
<place>
...
my.java
baki.query("select * from test.user")
It's not inject sql language, just plain text, unless second restart.
Please sign in to leave a comment.
Hi,
At first sight, it sounds like a bug. Is there anything related to it in the idea.log?
Hi Karol Lewandowski , I find this in idea.log, is that a reason?
how can I fix this?
Hi,
This is just information that your plugin cannot be dynamically unloaded. It is not an error. To understand the issue fully, could you please describe the steps to reproduce?
1. First I install my plugin, sql language injection works correctly;
2. I click uninstall the plugin, idea reminds me to Restart;
3. And then I install plugin again, idea did not reminds me to Restart, only the sql language injection not work;
4. I Restart idea again manually, then sql language injection works.
I see now and I think this is the expected behavior. Your plugin is not dynamic, so any uninstallation or installation activities require restart to work properly. Without restart, you cannot expect it works properly and things may break.
If it is possible, you can make your plugin dynamic: https://plugins.jetbrains.com/docs/intellij/dynamic-plugins.html
Dynamic plugins should work correctly without IDE restarts.