@Override
    protected void addCompletions(@NotNull CompletionParameters parameters,
                                  @NotNull ProcessingContext context,
                                  @NotNull CompletionResultSet result) {
      final PsiElement element = parameters.getOriginalPosition();
      if (element == null) return;
      final PsiFile file = element.getContainingFile();
      // Parameter references are filled with DocStringParameterReference#getVariants
      final PsiReference reference = file.findReferenceAt(parameters.getOffset());
      if (reference == null) {
        if (parameters.isAutoPopup()) return;
        final PyDocStringOwner docStringOwner = PsiTreeUtil.getParentOfType(element, PyDocStringOwner.class);
        final Module module = ModuleUtilCore.findModuleForPsiElement(element);
        if (module != null) {
          result = result.withPrefixMatcher(getPrefix(parameters.getOffset(), file));
          final Collection<String> identifiers = PyUtil.collectUsedNames(docStringOwner);
          for (String identifier : identifiers) {
            result.addElement(LookupElementBuilder.create(identifier).withAutoCompletionPolicy(AutoCompletionPolicy.NEVER_AUTOCOMPLETE));
          }

          final Collection<String> fileIdentifiers = PyUtil.collectUsedNames(parameters.getOriginalFile());
          for (String identifier : fileIdentifiers) {
            result.addElement(LookupElementBuilder.create(identifier).withAutoCompletionPolicy(AutoCompletionPolicy.NEVER_AUTOCOMPLETE));
          }
        }
      }
      // For reST declaration like ":param foo: int" "foo" is PsiMultiReference that combines DocStringParameterReference and DocStringTypeReference
      else if (reference instanceof PsiMultiReference) {
        for (PsiReference innerReference : ((PsiMultiReference)reference).getReferences()) {
          addVariantsFromDocstringReference(innerReference, result);
        }
      }
      else {
        addVariantsFromDocstringReference(reference, result);
      }
    }
@Override
    protected void addCompletions(@NotNull CompletionParameters parameters,
                                  @NotNull ProcessingContext context,
                                  @NotNull CompletionResultSet result)