@Override
  public PsiReference @NotNull [] getReferencesByElement(@NotNull final PsiElement element, @NotNull ProcessingContext context) {
    if (element == DocStringUtil.getParentDefinitionDocString(element)) {
      final PyStringLiteralExpression expr = (PyStringLiteralExpression)element;
      final List<TextRange> ranges = expr.getStringValueTextRanges();

      final String exprText = expr.getText();

      if (!ranges.isEmpty()) {
        final TextRange firstNodeRange = ranges.get(0);
        final int offset = firstNodeRange.getStartOffset();
        final String text = firstNodeRange.substring(exprText);
        final List<PsiReference> result = new ArrayList<>();
        // XXX: It does not work with multielement docstrings
        StructuredDocString docString = DocStringUtil.parse(text, element);
        if (docString instanceof TagBasedDocString taggedDocString) {
          final Set<TextRange> nameReferenceRanges = new HashSet<>();
          result.addAll(referencesFromNames(expr, offset, docString,
                                            taggedDocString.getTagArguments(TagBasedDocString.PARAM_TAGS),
                                            nameReferenceRanges,
                                            ReferenceType.PARAMETER));
          result.addAll(referencesFromNames(expr, offset, docString,
                                            taggedDocString.getTagArguments(TagBasedDocString.PARAM_TYPE_TAGS),
                                            nameReferenceRanges,
                                            ReferenceType.PARAMETER_TYPE));
          result.addAll(referencesFromNames(expr, offset, docString,
                                            docString.getKeywordArgumentSubstrings(),
                                            nameReferenceRanges,
                                            ReferenceType.KEYWORD));

          result.addAll(referencesFromNames(expr, offset, docString,
                                            taggedDocString.getTagArguments("var"),
                                            nameReferenceRanges,
                                            ReferenceType.VARIABLE));
          result.addAll(referencesFromNames(expr, offset, docString,
                                            taggedDocString.getTagArguments("cvar"),
                                            nameReferenceRanges,
                                            ReferenceType.CLASS_VARIABLE));
          result.addAll(referencesFromNames(expr, offset, docString,
                                            taggedDocString.getTagArguments("ivar"),
                                            nameReferenceRanges,
                                            ReferenceType.INSTANCE_VARIABLE));
          result.addAll(returnTypes(element, docString, offset));
        }
        else if (docString instanceof SectionBasedDocString sectioned) {
          result.addAll(referencesFromFields(expr, offset, sectioned.getParameterFields(), ReferenceType.PARAMETER));
          result.addAll(referencesFromFields(expr, offset, sectioned.getKeywordArgumentFields(), ReferenceType.KEYWORD));
          result.addAll(referencesFromFields(expr, offset, sectioned.getAttributeFields(),
                                             PyUtil.isTopLevel(element) ? ReferenceType.GLOBAL_VARIABLE : ReferenceType.VARIABLE));
          result.addAll(referencesFromFields(expr, offset, sectioned.getReturnFields(), null));
        }
        return result.toArray(PsiReference.EMPTY_ARRAY);
      }
    }
    return PsiReference.EMPTY_ARRAY;
  }
@Override
  public PsiReference @NotNull [] getReferencesByElement(@NotNull final PsiElement element, @NotNull ProcessingContext context)