I recently started developing a plugin for a simple XML-based language I use in some of my projects. For this plugin I need to make a choice between defining a new custom language (along with its filetype, parser definition, etc) and using the DOM API's provided by IntelliJ.
As I'm fairly new to plugin development, I'm not sure what would be the best approach. I'm starting this thread in the hope that someone more experienced can help with this choice.
The custom XML language is used to map custom (String) identifiers to classes in the project. It is a fairly simple language, which looks somewhat like this:
Other xml files might overwrite some of these mappings.
Using an API call (getFromMapping()), I can acquire a reference to a one of the mapped classes (which is instantiated via reflection).
Some of the things I would like to do with my plugin:
- give the mapping files a custom icon
- have line markers at getFromMapping() call sites which link to the mapping in the XML file.
- annotate getFromMapping() call sites if the identifier is not found in the mappings
- annotate <class/> element in the mappings if the class is not found on the classpath
- fold getFromMapping() call sites into something like /classname/ where the classname is resolved via the mappings
- add completion to getFromMapping() call sites
Most of these, I actually have already implemented, using a combination of a custom language and the DOM API's. As I've understood, these two should not be mixed, and this might explain some why I'm getting some strange exceptions like 'refused to parse text with Language: XML'. Therefore I'm wondering if I should go with the DOM API's, or define a custom language.
I'm looking forward to any suggestions.