What would i have to do to add the following functionality to IntelliJ:
In all files called ".foobar.xml" inside my project i want to have custom code/XML completion and custom syntax highlighting. The XML files will always have the same name ".foobar.xml" and can reside anywhere inside my project.
The XML files do _not_ have a DTD inside them, and we cannot add a DTD definition inside the file. It's a custom XML format by a vendor of ours, so we're stuck with that special XML format. Because it is an XML-based import/export format, mapping dynamically generated data structures to a file, it's probably not even possible to come up with a DTD at all. (If i am mistaken on this, please let me know).
All the element names, attributes, etc. are just copied from the data structure, which is more or less random, you can arbitrarily add properties and elements wherever you want. So there is obviously no fixed structure of the XML format. The only rules we can come up with to identify the types of the elements and properties, is for example:
- When an element has the property "widget:type" set to "user:dialog", then it's a user-dialog. And we know that user-dialogs have for example the mandatory properties "height" and "width" and about 100 optional properties.
- The "height" property within a user-dialog is always an integer,
- The "dialogType" property of a user-dialog can have the values "helper", "edit" or "config".
- Potential pitfall: With a different "widget:type" set to "system:dialog", the dialogType might have different possible values like "core", "mail", "acl", etc.
- Sometimes there are some minor child/parent rules we can define: E.g. an element with property "widget:type" = "dropdown" is required to have an "optionsList" child. This "optionsList" child must in turn have at least one "options" element.
These are just some examples, there are a lot more semi-defined rules like this. The best plan for us would be to start with "no rules at all" (where we are now) and as time goes on, add more and more rules to the custom code completion / syntax highlighting as necessary,
I hope this all makes sense somehow. Currently it is a real pain to edit these XML files, because you always have to make sure there are no typos, have to consult the vendor documentation all the time, etc. I just want to make our developer life a bit easier if possible. That's why i'd like to write a IntelliJ extension/plugin for this.
Any hints would be appreciated. :)