@Override
  public @NotNull Result checkAutoPopup(char charTyped,
                                        @NotNull Project project,
                                        @NotNull Editor editor,
                                        @NotNull PsiFile file) {
    if (charTyped != '&' || !(file instanceof HtmlFileImpl)) {
      return Result.CONTINUE;
    }
    PsiElement element = file.findElementAt(editor.getCaretModel().getOffset());
    if (element == null) {
      return Result.CONTINUE;
    }
    IElementType elementType = element.getNode().getElementType();
    PsiElement parent = element.getParent();
    if (elementType != XmlTokenType.XML_END_TAG_START
        && elementType != XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER
        && elementType != XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN
        && !((elementType == XmlTokenType.XML_DATA_CHARACTERS || elementType == XmlTokenType.XML_WHITE_SPACE) && parent instanceof XmlText)) {
      return Result.CONTINUE;
    }
    AutoPopupController.getInstance(project).scheduleAutoPopup(editor);
    return Result.STOP;
  }
@Override
  public @NotNull Result checkAutoPopup(char charTyped,
                                        @NotNull Project project,
                                        @NotNull Editor editor,
                                        @NotNull PsiFile file)