Add Custom HTML Tags

How can I add custom html tags through the open api? I would like to define some new elements so they do not register as warnings. I know how to do this through the UI, but how can I accomplish this programatically. I'm using the HTMLFileType.INSTANCE as my language instance. I would also like to offer the new elements up as auto completion, but I realize that might be a topic for another post.

Screen Shot 2015-05-31 at 2.59.37 PM.png

Comment actions Permalink

I was able to make the new tags available for completion, but they are still not showing up as valid input. I thought I'd paste the code if anyone else was looking to do the same. I would still like to add the same elements to the custom tags in the unknown tag inspection.

public class ISMLTagDescriptorsProvider implements XmlElementDescriptorProvider, XmlTagNameProvider {
    private final String[] ismlTagNames = {

XmlElementDescriptor getDescriptor(XmlTag tag) {
        return null;

    public void addTagNameVariants
(List<LookupElement> elements, XmlTag tag, String prefix) {
        for (String tagName : ismlTagNames) {
Comment actions Permalink

You need to provide implementation of getDescriptor() to make it work. see com.intellij.codeInspection.htmlInspections.HtmlUnknownTagInspectionBase#checkTag


Please sign in to leave a comment.