Package com.intellij.lang.javascript.index

Examples of com.intellij.lang.javascript.index.JSNamedElementProxy


  @Override
  public ResolveResult[] doResolve() {
    if (myReferencedName == null) return ResolveResult.EMPTY_ARRAY;

    if (AngularJSAsExpression.isAsControllerRef(myRef, myRef.getParent())) {
      final JSNamedElementProxy resolve = AngularIndexUtil.resolve(myParent.getProject(), AngularControllerIndex.INDEX_ID, myReferencedName);
      if (resolve != null) {
        return new JSResolveResult[]{new JSResolveResult(resolve)};
      }
    } else if (AngularJSFilterExpression.isFilterNameRef(myRef, myParent)) {
      final JSNamedElementProxy resolve = AngularIndexUtil.resolve(myParent.getProject(), AngularFilterIndex.INDEX_ID, myReferencedName);
      if (resolve != null) {
        return new JSResolveResult[] {new JSResolveResult(resolve)};
      }
    } else {
      final Collection<JSNamedElement> localVariables = getItemsByName(myReferencedName, myRef);
View Full Code Here


  public static final int BASE_VERSION = 16;
  private static final ConcurrentHashMap<String, Key<ParameterizedCachedValue<List<String>, Pair<Project, ID<String, Void>>>>> ourCacheKeys = new ConcurrentHashMap<String, Key<ParameterizedCachedValue<List<String>, Pair<Project, ID<String, Void>>>>>();
  private static final AngularKeysProvider PROVIDER = new AngularKeysProvider();

  public static JSNamedElementProxy resolve(final Project project, final ID<String, Void> index, final String lookupKey) {
    JSNamedElementProxy result = null;
    final JavaScriptIndex jsIndex = JavaScriptIndex.getInstance(project);
    final GlobalSearchScope scope = GlobalSearchScope.allScope(project);
    for (VirtualFile file : FileBasedIndex.getInstance().getContainingFiles(index, lookupKey, scope)) {
      final JSIndexEntry entry = jsIndex.getEntryForFile(file, scope);
      final JSNamedElementProxy resolve = entry != null ? entry.resolveAdditionalData(jsIndex, index.toString(), lookupKey) : null;
      if (resolve != null) {
        result = resolve;
        if (result.canNavigate()) break;
      }
    }
View Full Code Here

  public static String getInjectionEnd(Project project) {
    return getInjectionDelimiter(project, "endSymbol", DEFAULT_END);
  }

  private static String getInjectionDelimiter(Project project, final String id, final String defaultDelimiter) {
    final JSNamedElementProxy start = AngularIndexUtil.resolve(project, AngularInjectionDelimiterIndex.INDEX_ID, id);
    if (start != null) {
      return start.getIndexItem().getTypeString();
    }
    return defaultDelimiter;
  }
View Full Code Here

    PsiElement resolvedElement = resolveResult.getElement();
    if (resolvedElement == null || !resolveResult.isValidResult()) {
      return false;
    }
    if (resolvedElement instanceof JSNamedElementProxy) {
      JSNamedElementProxy proxy = (JSNamedElementProxy) resolvedElement;
      PsiElement element = proxy.getElement();
      return element != null && !(element instanceof PsiComment);
    }
    return !(resolvedElement instanceof PsiComment);
  }
View Full Code Here

  }

  @NotNull
  @Override
  public NavigationItem[] getItemsByName(String name, String pattern, Project project, boolean includeNonProjectItems) {
    final JSNamedElementProxy item = AngularIndexUtil.resolve(project, AngularSymbolIndex.INDEX_ID, name);
    return item != null ? new NavigationItem[] {item} : NavigationItem.EMPTY_NAVIGATION_ITEM_ARRAY;
  }
View Full Code Here

  public static class AngularJSDirectiveElementDescriptor implements ElementDescriptionProvider {
    @Nullable
    @Override
    public String getElementDescription(@NotNull PsiElement element, @NotNull ElementDescriptionLocation location) {
      JSNamedElementProxy directive = DirectiveUtil.getDirective(element);
      if (directive != null) {
        if (location instanceof UsageViewTypeLocation) return "directive";
        return DirectiveUtil.attributeToDirective(directive.getName());
      }
      return null;
    }
View Full Code Here

  }

  @Override
  public void processQuery(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull final Processor<PsiReference> consumer) {
    final PsiElement element = queryParameters.getElementToSearch();
    final JSNamedElementProxy directive = DirectiveUtil.getDirective(element);
    if (directive == null) return;

    queryParameters.getOptimizer().searchWord(directive.getName(), queryParameters.getEffectiveSearchScope(), true, directive);
  }
View Full Code Here

      result.put(directiveName + "-end", createDescriptor(project, directiveName + "-end"));
    }
  }

  private static ThreeState isApplicable(Project project, String directiveName, String tagName, final ID<String, Void> index) {
    final JSNamedElementProxy directive = AngularIndexUtil.resolve(project, index, directiveName);
    if (directive == null) {
      return ThreeState.UNSURE;
    }

    final String restrictions = directive.getIndexItem().getTypeString();
    if (restrictions != null) {
      final String[] split = restrictions.split(";", -1);
      final String restrict = AngularIndexUtil.convertRestrictions(project, split[0]);
      final String tag = split[1];
      if (!StringUtil.isEmpty(restrict) && !StringUtil.containsIgnoreCase(restrict, "A")) {
View Full Code Here

TOP

Related Classes of com.intellij.lang.javascript.index.JSNamedElementProxy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.