Package com.intellij.psi

Examples of com.intellij.psi.PsiLanguageInjectionHost$Shred


*/
public class GrCucumberStepDeclarationSearcher extends PomDeclarationSearcher {

  @Override
  public void findDeclarationsAt(@NotNull PsiElement element, int offsetInElement, Consumer<PomTarget> consumer) {
    PsiLanguageInjectionHost host = InjectedLanguageManager.getInstance(element.getProject()).getInjectionHost(element);
    if (host != null) {
      element = host;
    }
    if (element.getParent() instanceof GrLiteral) {
      element = element.getParent();
View Full Code Here


    }
  }

  private static boolean scopeMatches(PsiElement element, PsiElement declaration) {
    final InjectedLanguageManager injector = InjectedLanguageManager.getInstance(element.getProject());
    final PsiLanguageInjectionHost elementContainer = injector.getInjectionHost(element);
    final XmlTagChild elementTag = PsiTreeUtil.getNonStrictParentOfType(elementContainer, XmlTag.class, XmlText.class);
    final PsiLanguageInjectionHost declarationContainer = injector.getInjectionHost(declaration);
    final XmlTagChild declarationTag = PsiTreeUtil.getNonStrictParentOfType(declarationContainer, XmlTag.class, XmlText.class);

    if (declarationContainer != null && elementContainer != null && elementTag != null && declarationTag != null) {
      return PsiTreeUtil.isAncestor(declarationTag, elementTag, true) ||
             (PsiTreeUtil.isAncestor(declarationTag, elementTag, false) &&
              declarationContainer.getTextOffset() < elementContainer.getTextOffset());
    }
    return true;
  }
View Full Code Here

  public static boolean isAsControllerRef(PsiReference ref, PsiElement parent) {
    if (parent instanceof AngularJSAsExpression && ref == parent.getFirstChild()) {
      return true;
    }
    final InjectedLanguageManager injector = InjectedLanguageManager.getInstance(parent.getProject());
    final PsiLanguageInjectionHost host = injector.getInjectionHost(parent);
    final PsiElement hostParent = host instanceof XmlAttributeValueImpl ? host.getParent() : null;
    final String normalized = hostParent instanceof XmlAttribute ?
                              DirectiveUtil.normalizeAttributeName(((XmlAttribute)hostParent).getName()) : null;
    return "ng-controller".equals(normalized);
  }
View Full Code Here

TOP

Related Classes of com.intellij.psi.PsiLanguageInjectionHost$Shred

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.