Java 类com.intellij.lang.parameterInfo.ParameterInfoContext 实例源码

项目:consulo-csharp    文件:CSharpParameterInfoHandler.java   
@Nullable
@Override
@RequiredReadAction
public ItemToShow[] getParametersForLookup(LookupElement item, ParameterInfoContext context)
{
    Object object = item.getObject();

    if(object instanceof DotNetLikeMethodDeclaration)
    {
        return new ItemToShow[]{new ItemToShow((CSharpSimpleLikeMethod) object, context.getFile())};
    }
    if(object instanceof DotNetVariable)
    {
        DotNetVariable variable = (DotNetVariable) object;
        DotNetTypeRef dotNetTypeRef = variable.toTypeRef(tracksParameterIndex());

        DotNetTypeResolveResult typeResolveResult = dotNetTypeRef.resolve();
        if(typeResolveResult instanceof CSharpLambdaResolveResult)
        {
            return new ItemToShow[]{new ItemToShow((CSharpSimpleLikeMethod) typeResolveResult, variable)};
        }
    }
    return ItemToShow.EMPTY_ARRAY;
}
项目:consulo-csharp    文件:CSharpGenericParameterInfoHandler.java   
@Nullable
private static DotNetGenericParameterListOwner findGenericParameterOwner(ParameterInfoContext context)
{
    final PsiElement at = context.getFile().findElementAt(context.getEditor().getCaretModel().getOffset());
    if(at == null)
    {
        return null;
    }

    DotNetTypeList typeList = PsiTreeUtil.getParentOfType(at, DotNetTypeList.class);
    if(typeList == null)
    {
        return null;
    }

    PsiElement parent = typeList.getParent();
    if(!(parent instanceof CSharpReferenceExpression))
    {
        return null;
    }

    int argumentsSize = DotNetPsiCountUtil.countChildrenOfType(typeList.getNode(), CSharpTokens.COMMA) + 1;

    CSharpReferenceExpression referenceExpression = (CSharpReferenceExpression) parent;
    ResolveResult[] resolveResults = referenceExpression.multiResolve(true);
    for(ResolveResult resolveResult : resolveResults)
    {
        PsiElement element = resolveResult.getElement();
        if(element instanceof DotNetGenericParameterListOwner)
        {
            int genericParametersCount = ((DotNetGenericParameterListOwner) element).getGenericParametersCount();
            if(genericParametersCount == argumentsSize)
            {
                return (DotNetGenericParameterListOwner) element;
            }
        }
    }

    return null;
}
项目:consulo-javascript    文件:JSParameterInfoHandler.java   
@Override
public Object[] getParametersForLookup(final LookupElement item, final ParameterInfoContext context)
{
    if(!(item instanceof MutableLookupElement))
    {
        return null;
    }

    PsiElement element = item.getPsiElement();
    if(element instanceof JSFunction)
    {
        final JSFunction originalFunction = (JSFunction) element;
        final List<JSFunction> lookupItems = new ArrayList<JSFunction>();
        Set<String> availableSignatures = new HashSet<String>();

        for(PsiElement el : DefinitionsScopedSearch.search(originalFunction))
        {
            doAddSignature(lookupItems, availableSignatures, el);
        }

        if(lookupItems.size() == 0)
        {
            lookupItems.add(originalFunction);
        }

        return lookupItems.toArray(new Object[lookupItems.size()]);
    }

    return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
项目:consulo-javascript    文件:JSParameterInfoHandler.java   
@Override
public Object[] getParametersForDocumentation(final JSFunction p, final ParameterInfoContext context)
{
    final JSParameterList list = p.getParameterList();
    if(list != null)
    {
        return list.getParameters();
    }
    return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
项目:consulo-apache-velocity    文件:VtlParameterInfoHandler.java   
@Nullable
private static VtlArgumentList findArgumentList(final ParameterInfoContext context) {
    final PsiFile file = context.getFile();

    PsiDocumentManager.getInstance(file.getProject()).commitDocument(context.getEditor().getDocument());
    final PsiElement elementAt = file.getViewProvider().findElementAt(context.getOffset(), VtlLanguage.INSTANCE);
    if (elementAt == null) {
        return null;
    }
    final VtlCallExpression call = PsiTreeUtil.getParentOfType(elementAt, VtlCallExpression.class);
    if (call == null) {
        return null;
    }
    return call.findArgumentList();
}
项目:consulo-java    文件:MethodParameterInfoHandler.java   
@Override
public Object[] getParametersForDocumentation(final Object p, final ParameterInfoContext context)
{
    if(p instanceof MethodCandidateInfo)
    {
        return ((MethodCandidateInfo) p).getElement().getParameterList().getParameters();
    }
    if(p instanceof PsiMethod)
    {
        return ((PsiMethod) p).getParameterList().getParameters();
    }
    return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
项目:consulo-csharp    文件:CSharpParameterInfoHandler.java   
@Nullable
@Override
public Object[] getParametersForDocumentation(ItemToShow p, ParameterInfoContext context)
{
    return new Object[0];
}
项目:consulo-csharp    文件:CSharpGenericParameterInfoHandler.java   
@Nullable
@Override
public Object[] getParametersForLookup(LookupElement item, ParameterInfoContext context)
{
    return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
项目:consulo-csharp    文件:CSharpGenericParameterInfoHandler.java   
@Nullable
@Override
public Object[] getParametersForDocumentation(DotNetGenericParameterListOwner p, ParameterInfoContext context)
{
    return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
项目:intellij-xquery    文件:XQueryParameterInfoHandler.java   
@Nullable
@Override
public Object[] getParametersForLookup(LookupElement item, ParameterInfoContext context) {
    return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
项目:intellij-xquery    文件:XQueryParameterInfoHandler.java   
@Nullable
@Override
public Object[] getParametersForDocumentation(Object p, ParameterInfoContext context) {
    return null;
}
项目:intellij-xquery    文件:XQueryParameterInfoHandler.java   
private XQueryArgumentList getArgumentList(ParameterInfoContext context) {
    PsiElement at = context.getFile().findElementAt(context.getOffset());
    return PsiTreeUtil.getParentOfType(at, XQueryArgumentList.class);
}
项目:consulo-apache-velocity    文件:VtlParameterInfoHandler.java   
public Object[] getParametersForLookup(final LookupElement item, final ParameterInfoContext context) {
    //todo
    return null;
}
项目:consulo-apache-velocity    文件:VtlParameterInfoHandler.java   
public Object[] getParametersForDocumentation(final VtlCallable callable, final ParameterInfoContext context) {
    return new Object[]{callable};
}
项目:consulo-java    文件:MethodParameterInfoHandler.java   
@Override
public Object[] getParametersForLookup(LookupElement item, ParameterInfoContext context)
{
    final List<? extends PsiElement> elements = JavaCompletionUtil.getAllPsiElements(item);
    return elements != null && !elements.isEmpty() && elements.get(0) instanceof PsiMethod ? elements.toArray() : null;
}