boolean (@Nullable PsiElement element) { PsiFile file = doIfNotNull(element, PsiElement::getContainingFile); if (file == null || !isHtmlElementInTextCompletionEnabledForFile(file)) { return false; } if (isDeselectingFirstPopupItemDisabled(element)) { return false; } IElementType elementType = element.getNode().getElementType(); if ((elementType == XmlTokenType.XML_DATA_CHARACTERS || element.getNode().getElementType() == XmlTokenType.XML_WHITE_SPACE) && (element.getParent() instanceof XmlText || element.getParent() instanceof XmlDocument) ) { return !element.getText().endsWith("<"); } if (elementType == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN) { return element.getText().contains("&"); } return false; }