Adding support for a custom XML format
Hi!
I should start off by mentioning that I am very new to IntelliJ IDEA plugin development, and I am probably using inconsistent or completely incorrect terminology to describe what I want to do. Please bear with me. :)
Anyway, what I want to do is develop a plugin that can understand a custom XML format. I started off by following the plugin development tutorial "SimplePlugin". This led me in the direction to create a FileType and a Language for the extension '.xml'. This turned out to be a very bad idea, since it probably overwrites the default XML file type and language.
Then I thought I should create a language dialect of XML, but I'm not really sure that's what I want to do either. I found that there was almost no documentation on how to create a language dialect, or maybe I just can't find it.
Now I'm trying to find an open source IntelliJ IDEA plugin that provides similar functionality as to what I want to provide in my plugin. This include plugins that can understand Maven pom.xml files, J2EE web.xml files and things of that nature (that understand a certain XML format). I haven't really found any plugins of this kind though.
Can anyone point me in the right direction here?
Best Regards,
Viktor Rutberg
Please sign in to leave a comment.
This sounds like DOM might be the solution for your plugin
http://confluence.jetbrains.com/display/IDEADEV/Accessing+XML+through+IntelliJ+IDEA+DOM
You can find sample sources/plugins on the very bottom of that page.
Hi Yann,
Thanks for you link. I have already skimmed it, but now that I know that it's probably a road I want to go down I will look at it more carefully.
I also have a follow-up question: I want to provide editor support for my custom XML format. This includes for example "go to definition", being able to recognize duplicate definitions, finding broken usages (i.e. trying to use a value that is not defined in the project), and type-ahead on values. Will DOM suffice for this as well, or do I have to use a lexer for this?
Best Regards,
Viktor Rutberg
Yes, DOM will allow you to implement all of these features.