public static boolean isTemplateDataFile(@NotNull PsiFile file) {
    FileViewProvider viewProvider = file.getViewProvider();
    return viewProvider instanceof TemplateLanguageFileViewProvider &&
                file == viewProvider.getPsi(((TemplateLanguageFileViewProvider)viewProvider).getTemplateDataLanguage());
  }
public static boolean isTemplateDataFile(@NotNull PsiFile file)