XmlTag (Editor editor, PsiFile file) { int offset = editor.getCaretModel().getOffset(); FileViewProvider provider = file.getViewProvider(); for (Language language : provider.getLanguages()) { PsiElement element = provider.findElementAt(offset, language); XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class); if (tag != null && XmlChildRole.START_TAG_END_FINDER.findChild(tag.getNode()) != null) { return tag; } } return null; }