Pycharm Plugin: inject python in xml attribute does not work

Answered

I am creating a Pycharm plugin in which i want to inject the python language in an xml attribute. I followed the documentation and have the following setup:

xmlInjections.xml

<LanguageInjectionConfiguration>
    <injection language="python" injector-id="xml" enabled="true">
        <display-name>Eval Injections</display-name>
        <single-file/>
        <place><![CDATA[xmlAttribute().withLocalName(string().equalTo("eval"))]]></place>
    </injection>
</LanguageInjectionConfiguration>

 

and in my plugin.xml file:

<depends>org.intellij.intelliLang</depends>

<extensions defaultExtensionNs="org.intellij.intelliLang">
    <injectionConfig config="injections/xmlInjections.xml"/>
</extensions>

When i run the plugin the injection does not show up in the settings, and i don't get any errors. What am i doing wrong?

0
3 comments

Hi Allesio,

According to the information on https://www.jetbrains.com/help/idea/using-language-injections.html, is the IntelliLang plugin enabled in your IDE?

0

Yes it is bundled with the PyCharm IDE

0

I found out what i was doing wrong, i forgot following line in my plugin.xml file

<depends>com.intellij.modules.lang</depends>

0

Please sign in to leave a comment.