XML DOM API - Tag Completion

Hello,

I thought I would try to create a plugin for an XML like language using the XML DOM API. I created classes extending DomElement with @SubTag, @SubTagList and @Attribute annotations. I thought that using the DOM API would automatically add tag completion as well as attribute completion. The plugin does not mark any bad tags or attributes. I was wondering what I need to do to enable completion to work. I could not gather from the plugins cited at the end of the DOM API page anything about completion.

I even tried to write my own DTD so I could use the DOM API generator, but no files where generated, and no error was produced, it simply did not do anything. I have never created a DTD file, so it might not have been done properly.

I am not really sure what to do now, or where to look. Any thoughts or advice?

1 comment

So I was trying to run the DOM API as its own file type, and nothing was working there, but I decided to create just an XML file with the root tag of my files, and it began to generate this error whenever I tried to edit text within tag.

2018-10-03 16:13:02,441 [1038908] ERROR - n.impl.GeneralHighlightingPass - In file: file:///{{dir}}/untitled1/Test.xml 
java.lang.IllegalArgumentException: Argument for @NotNull parameter 'defaultValue' of com/intellij/util/ObjectUtils.notNull must not be null
at com.intellij.util.ObjectUtils.$$$reportNull$$$0(ObjectUtils.java)
at com.intellij.util.ObjectUtils.notNull(ObjectUtils.java)
at com.intellij.util.ObjectUtils.notNull(ObjectUtils.java:88)
at com.intellij.util.ObjectUtils.assertNotNull(ObjectUtils.java:49)
2018-10-03 16:13:02,442 [1038909] ERROR - n.impl.GeneralHighlightingPass - IntelliJ IDEA 2018.2.4 Build #IU-182.4505.22
2018-10-03 16:13:02,443 [1038910] ERROR - n.impl.GeneralHighlightingPass - JDK: 1.8.0_162
2018-10-03 16:13:02,443 [1038910] ERROR - n.impl.GeneralHighlightingPass - VM: Java HotSpot(TM) 64-Bit Server VM
2018-10-03 16:13:02,443 [1038910] ERROR - n.impl.GeneralHighlightingPass - Vendor: Oracle Corporation
2018-10-03 16:13:02,443 [1038910] ERROR - n.impl.GeneralHighlightingPass - OS: Mac OS X
2018-10-03 16:13:02,443 [1038910] ERROR - n.impl.GeneralHighlightingPass - Last Action: EditorBackSpace


Also, as an example of the elements I created. This is the root element: 

*MjmlDomElement simply extends DomElement with a name strategy annotation

public interface Mjml extends MjmlDomElement {

@SubTag("mj-body")
MjBody getMjBody();

@SubTag("mj-head")
MjHead getMjHead();

@Attribute("owa")
MjDomAttribute<String> getOwa();

@Attribute("lang")
MjDomAttribute<String> getLanguage();
}
0

Please sign in to leave a comment.