use of org.angularjs.lang.AngularJSLanguage in project intellij-plugins by JetBrains.
the class AngularJSIndexingHandler method addTypeFromResolveResult.
@Override
public boolean addTypeFromResolveResult(JSTypeEvaluator evaluator, PsiElement resolveResult, boolean hasSomeType) {
if (!AngularIndexUtil.hasAngularJS(resolveResult.getProject()))
return false;
if (resolveResult instanceof JSDefinitionExpression && resolveResult.getLanguage() instanceof AngularJSLanguage) {
final PsiElement resolveParent = resolveResult.getParent();
if (resolveParent instanceof AngularJSAsExpression) {
final String name = resolveParent.getFirstChild().getText();
final JSTypeSource source = JSTypeSourceFactory.createTypeSource(resolveResult);
final JSType type = JSNamedType.createType(name, source, JSContext.INSTANCE);
evaluator.addType(type, resolveResult);
return true;
}
}
if (resolveResult instanceof JSVariable && resolveResult.getLanguage() instanceof AngularJSLanguage) {
PsiElement resolveParent = resolveResult.getParent().getParent();
if (resolveParent instanceof AngularJSRepeatExpression) {
if (calculateRepeatParameterType(evaluator, (AngularJSRepeatExpression) resolveParent)) {
return true;
}
}
}
if (resolveResult instanceof JSParameter && evaluator.isFromCurrentFile(resolveResult) && isInjectable(resolveResult)) {
final String name = ((JSParameter) resolveResult).getName();
final JSTypeSource source = JSTypeSourceFactory.createTypeSource(resolveResult);
final JSType type = JSNamedType.createType(name, source, JSContext.UNKNOWN);
evaluator.addType(type, resolveResult);
}
return false;
}
Aggregations