Xml Language Extension and TagSynchronization
Answered
Hey,
I made a custom language
public class MiniMessageLanguage extends Language {
private MiniMessageLanguage() {
this(XMLLanguage.INSTANCE, "MiniMessage");
}
}
I also implemented the XmlExtension extension point and the XmlTypedHandlersAdditionalSupport extension point.
public class MiniMessageHandlersAdditionalSupport implements XmlTypedHandlersAdditionalSupport {
@Override
public boolean isAvailable(@NotNull PsiFile psiFile, @NotNull Language language) {
return language.isKindOf(MiniMessageLanguage.INSTANCE);
}
}
However, tag synchronization and typed handlers don't work in MiniMessage files.
When additionally extending XmlLanguage in MiniMessageLanguage, both tag synchronization and typed handlers work. Then however, my XmlExtension method isValidTagNameChar
will no longer be called from XmlTag.setName("#123123")
.
Also I noticed that tag synchronization never works in injected XML. This should maybe be reported.
Please sign in to leave a comment.
Hi,
It's hard to understand what could be the issue. Did you try to debug
com.intellij.codeInsight.editorActions.XmlTagNameSynchronizer
? Does it event create a synchronizer for your language?Or, in case of extending
XmlLanguage
,com.intellij.codeInsight.editorActions.XmlTagNameSynchronizer.TagNameSynchronizer#isValidTagNameChar
andcom.intellij.xml.XmlExtension#calcExtension
? Maybe anotherXmlExtension
takes precedence and you should define theorder
attribute to push your extension before the “conflicting” one?