Open file with unsupported Language (or File Extension)

Hi all,

I'm writing a small plugin for my Snippet Manager.
The snippets are opened in a new editor tab which works so far.

LightVirtualFile file = new LightVirtualFile("FILENAME" + "FILEEXTENSION", snippet.get("code").getAsString());
DataContext dataContext = DataManager.getInstance().getDataContext();
Project project = (Project) dataContext.getData(DataConstants.PROJECT);
FileEditorManager manager = FileEditorManager.getInstance(project);
manager.openFile(file, true, true);

But if let's say the file extension is .php which is not supported by IntelliJ IDEA no editor is opend.
Is there any way to either check if the language is supported and if not open it as a text file or any other solution?

Thanks in  advance.

Please sign in to leave a comment.