Search in sources :

Example 1 with JSReferenceExpressionImpl

use of com.intellij.lang.javascript.psi.impl.JSReferenceExpressionImpl in project intellij-plugins by JetBrains.

the class AngularJSCompletionContributor method fillCompletionVariants.

@Override
public void fillCompletionVariants(@NotNull final CompletionParameters parameters, @NotNull final CompletionResultSet result) {
    if (!getElementLanguage(parameters).is(AngularJSLanguage.INSTANCE))
        return;
    if (AngularMessageFormatCompletion.messageFormatCompletion(parameters, result))
        return;
    PsiReference ref = parameters.getPosition().getContainingFile().findReferenceAt(parameters.getOffset());
    if (ref instanceof JSReferenceExpressionImpl && ((JSReferenceExpressionImpl) ref).getQualifier() == null) {
        final PsiElement parent = ((JSReferenceExpressionImpl) ref).getParent();
        if (addFilterVariants(result, parameters, ref, parent))
            return;
        if (addControllerVariants(result, parameters, ref, parent))
            return;
        AngularJSProcessor.process(parameters.getPosition(), element -> {
            final String name = element.getName();
            if (name != null) {
                result.consume(JSLookupUtilImpl.createPrioritizedLookupItem(element, name, NG_VARIABLE_PRIORITY, false, false));
            }
        });
    }
}
Also used : PsiReference(com.intellij.psi.PsiReference) JSReferenceExpressionImpl(com.intellij.lang.javascript.psi.impl.JSReferenceExpressionImpl) PsiElement(com.intellij.psi.PsiElement)

Aggregations

JSReferenceExpressionImpl (com.intellij.lang.javascript.psi.impl.JSReferenceExpressionImpl)1 PsiElement (com.intellij.psi.PsiElement)1 PsiReference (com.intellij.psi.PsiReference)1