private Collection<PsiFileSystemItem> getContext(PsiElement element, PsiFile file) {
    XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
    if (!myAcceptSelf && tag != null) {
      tag = tag.getParentTag();
    }
    while (tag != null) {
      XmlAttribute base = tag.getAttribute("base", XmlUtil.XML_NAMESPACE_URI);
      if (base != null) {
        XmlAttributeValue value = base.getValueElement();
        if (value != null) {
          PsiReference reference = value.getReference();
          if (reference instanceof PsiPolyVariantReference) {
            ResolveResult[] results = ((PsiPolyVariantReference)reference).multiResolve(false);
            return ContainerUtil.map(results, result -> (PsiFileSystemItem)result.getElement());
          }
        }
      }
      tag = tag.getParentTag();
    }
    PsiDirectory directory = file.getContainingDirectory();
    return ContainerUtil.createMaybeSingletonList(directory);
  }
private Collection<PsiFileSystemItem> getContext(PsiElement element, PsiFile file)