Contributing an annotator

Hi all.

What i want to do is simply create an Annotator for the HtmlLanguage.

I can see that the HTMLLanguage class returns no annotator. The problem is that i don't see any set method for the annotator so what i had to do was implement my own version of the HTMLFileType and HTMLLanguage that is exactly the same as the one provided by IntelliJ but the getAnnotator() method returns my annotator.
The ugliest part is still to come, for my file type to be used instead of the default one i have to do the following:

String[] extensions = FileTypeManager.getInstance().getAssociatedExtensions(StdFileTypes.HTML);
((FileTypeManagerEx) FileTypeManager.getInstance()).unregisterFileType(StdFileTypes.HTML);
FileTypeManager.getInstance().registerFileType(myFileType, extensions);

As you all might agree, this is not very pretty. So my question is, is there any other way of doing ? If not i will create an issue for this to be possible.

Comment actions Permalink

if you're using Demetra you can use Language.injectAnnotator()

Comment actions Permalink

I'm not, but still, good to hear this is already done for Demetra. I guess i'll stick with this implementation until i migrate to Demetra.



Please sign in to leave a comment.