Mixing languages in EditorTextField

I am using the following code to set up an EditorTextField:

final PsiFile psiFileFromText = PsiFileFactory.getInstance(project).createFileFromText("newSnippet." + fileExtension, psiFile.getLanguage(), selectedText, true, false);
EditorTextField editorTextField = new EditorTextField(newDocument, project, psiFile.getFileType(), false, false) {
   protected EditorEx createEditor() {
      EditorEx editor = super.createEditor();
      
editor.setVerticalScrollbarVisible(true);
      
editor.setHorizontalScrollbarVisible(true);
      return
editor;
   
}
};

psiFile is the current file in the active editor of the IDE.

I want to mix the following languages:

  • php
  • html
  • xhtml
  • javascript

With the implementation above HTML tags aren't recognized in the EditorTextfield if psiFile.getLanguage() is php.
What do I have to change in order to mix the languages?

Thanks in advance.

Please sign in to leave a comment.