@NotNull private List<PropTypeBean> findPropsNameListWithIdentityReference(String identity, PsiElement psiElement){ return PsiTreeUtil.findChildrenOfType(psiElement, LeafPsiElement.class) .stream() .filter(o -> o.getText().equals(identity)) .filter(o -> o.getElementType().toString().equals("JS:IDENTIFIER")) .filter(o -> { if(o.getParent() instanceof JSReferenceExpressionImpl){ JSReferenceExpressionImpl parent = (JSReferenceExpressionImpl) o.getParent(); if(parent.getTreeNext()!=null && parent.getTreeNext().getElementType().toString().equals("JS:DOT") &&parent.getTreeNext().getTreeNext()!=null){ return true; } } return false; }) .map(o -> ((JSReferenceExpressionImpl)o.getParent()).getTreeNext().getTreeNext().getText()) .distinct() .map(o -> new PropTypeBean(o,"any", false)) .collect(Collectors.toList()); }
@Override public void fillCompletionVariants(@NotNull final CompletionParameters parameters, @NotNull final CompletionResultSet result) { if (!getElementLanguage(parameters).is(EmberJSLanguage.INSTANCE)) return; PsiReference ref = parameters.getPosition().getContainingFile().findReferenceAt(parameters.getOffset()); if (ref instanceof JSReferenceExpressionImpl && ((JSReferenceExpressionImpl)ref).getQualifier() == null) { final PsiElement parent = ((JSReferenceExpressionImpl)ref).getParent(); // if (addControllerVariants(result, ref, parent)) return; EmberJSProcessor.process(parameters.getPosition(), new Consumer<JSNamedElement>() { @Override public void consume(JSNamedElement element) { result.consume(JSLookupUtilImpl.createPrioritizedLookupItem(element, element.getName(), EMBER_VARIABLE_PRIORITY, false, false)); } }); } }
public static @Nullable JSExpression getRealRefExprQualifier(final JSReferenceExpression expr) { final JSExpression qualifier = ((JSReferenceExpressionImpl) expr).getResolveQualifier(); if(qualifier != null) { return qualifier; } if(isExprInTypeContext(expr)) { final JSImportedElementResolveResult resolved = JSImportHandlingUtil.resolveTypeNameUsingImports(expr); if(resolved == null) { return expr.getQualifier(); } return getRealRefExprQualifierFromResult(expr, resolved); } return qualifier; }
public EmberJSReferenceExpressionResolver(JSReferenceExpressionImpl expression, PsiFile file) { super(expression, file); }
@NotNull @Override public JSResolveUtil.Resolver<JSReferenceExpressionImpl> createReferenceExpressionResolver(JSReferenceExpressionImpl referenceExpression, PsiFile containingFile) { return new EmberJSReferenceExpressionResolver(referenceExpression, containingFile); }