Example #1
0
  public Collection<PsiElement> getJetExtensionFunctionsByName(
      @NotNull String name, @NotNull GlobalSearchScope scope) {
    HashSet<PsiElement> functions = new HashSet<PsiElement>();
    functions.addAll(JetExtensionFunctionNameIndex.getInstance().get(name, project, scope));
    functions.addAll(
        JetFromJavaDescriptorHelper.getTopExtensionFunctionPrototypesByName(name, project, scope));

    return functions;
  }
Example #2
0
  /**
   * Get jet extensions top-level function names. Method is allowed to give invalid names - all
   * result should be checked with getAllJetExtensionFunctionsByName().
   *
   * @return
   */
  @NotNull
  public Collection<String> getAllJetExtensionFunctionsNames(@NotNull GlobalSearchScope scope) {
    Set<String> extensionFunctionNames = new HashSet<String>();

    extensionFunctionNames.addAll(JetExtensionFunctionNameIndex.getInstance().getAllKeys(project));
    extensionFunctionNames.addAll(
        JetFromJavaDescriptorHelper.getTopExtensionFunctionNames(project, scope));

    return extensionFunctionNames;
  }
Example #3
0
  @Override
  public void indexFunction(PsiJetFunctionStub stub, IndexSink sink) {
    String name = stub.getName();
    if (name != null) {
      if (stub.isTopLevel()) {
        // Collection only top level functions as only they are expected in completion without
        // explicit import
        if (!stub.isExtension()) {
          sink.occurrence(JetShortFunctionNameIndex.getInstance().getKey(), name);
        } else {
          sink.occurrence(JetExtensionFunctionNameIndex.getInstance().getKey(), name);
        }

        FqName topFQName = stub.getTopFQName();
        if (topFQName != null) {
          sink.occurrence(
              JetTopLevelFunctionsFqnNameIndex.getInstance().getKey(), topFQName.getFqName());
        }
      }

      sink.occurrence(JetAllShortFunctionNameIndex.getInstance().getKey(), name);
    }
  }