Is it possible to change the PSI type of an element

In our plugin we are managing Java script files. we have some special comments like /*HTML  */ in JS files.Intellij is parsing these comments as PSComments but I want to highlight them as html.
The other problem is that inside these comments we can have javascript inside <%= %>. Is it possible to have syntax highlighting of Javascript here.

So I want in editor when I have a comment like this :

/*HTML
  <div>
       <%= i++ %>
</div>
*/

I want that intellij can handle both html and javascript inside comment as normal html and javascript. another problem is that I don't have indenting in this case and I want to keep indenting as well. I s there any good solution for this?

Please sign in to leave a comment.