XmlTag (PsiFile psifile) { XmlFile xmlFile = null; if (psifile instanceof XmlFile) { xmlFile = (XmlFile)psifile; } else if (psifile.getViewProvider() instanceof TemplateLanguageFileViewProvider viewProvider) { if (viewProvider.getPsi(viewProvider.getTemplateDataLanguage()) instanceof XmlFile) { xmlFile = (XmlFile)viewProvider.getPsi(viewProvider.getTemplateDataLanguage()); } } if (xmlFile != null) { return xmlFile.getDocument().getRootTag(); } else { return null; } }