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.

2 comments

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

0

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.

Thanks.

0

Please sign in to leave a comment.