Custom Language: New Language Based on HTML

I'm trying to create a custom language which is an extension of HTML, mapped
to a custom file type.

Now I've created a new LanguageFileType, as shown in the custom language
documentation, and have also created a new Language. I want to keep the
syntax highlighting and completion of the current HTML language
implementation and then build in my custom highlighting and completion on
top. Now I thought it would be as simple as extending the HTMLLanguage
class, but when I test out my plugin it throws the following exception every
time I type in a file mapped to my custom Language (I can put in the full
exception if need be, but thought this bit is the most relevant section):

at com.intellij.psi.impl.source.PsiFileImpl.clone(
at com.intellij.psi.impl.source.PsiFileImpl.clone(

My question is really the following - am I going about this in completely
the wrong way? I looked at injecting an Annotator into the HTML file type,
but since I only want my custom highlighting on my specific file type I
decided this wasn't the best way to go about it. Any advice is much
appreciated, since I don't really want to have to re-write all of the base
HTML syntax checking!

Comment actions Permalink

I'm getting the same behaviour.
Did you manage to solve this ?

Comment actions Permalink

(just for future reference, as this post is kinda old)

When building templating languages, you shouldn't extend HTML, but create a MultiplePsiFilesPerDocumentFileViewProvider as written here:


Please sign in to leave a comment.