com.intellij.lang.parameterInfo.ParameterInfoContext Java Examples

The following examples show how to use com.intellij.lang.parameterInfo.ParameterInfoContext. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CSharpParameterInfoHandler.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #2
Source File: CSharpGenericParameterInfoHandler.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@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;
}
 
Example #3
Source File: ORParameterInfoHandlerWithTabActionSupport.java    From reasonml-idea-plugin with MIT License 4 votes vote down vote up
@Nullable
@Override
public Object[] getParametersForLookup(LookupElement item, ParameterInfoContext context) {
    return null;
}
 
Example #4
Source File: CSharpParameterInfoHandler.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public Object[] getParametersForDocumentation(ItemToShow p, ParameterInfoContext context)
{
	return new Object[0];
}
 
Example #5
Source File: CSharpGenericParameterInfoHandler.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public Object[] getParametersForLookup(LookupElement item, ParameterInfoContext context)
{
	return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
 
Example #6
Source File: CSharpGenericParameterInfoHandler.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public Object[] getParametersForDocumentation(DotNetGenericParameterListOwner p, ParameterInfoContext context)
{
	return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
 
Example #7
Source File: XQueryParameterInfoHandler.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public Object[] getParametersForLookup(LookupElement item, ParameterInfoContext context) {
    return ArrayUtil.EMPTY_OBJECT_ARRAY;
}
 
Example #8
Source File: XQueryParameterInfoHandler.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public Object[] getParametersForDocumentation(Object p, ParameterInfoContext context) {
    return null;
}
 
Example #9
Source File: XQueryParameterInfoHandler.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
private XQueryArgumentList getArgumentList(ParameterInfoContext context) {
    PsiElement at = context.getFile().findElementAt(context.getOffset());
    return PsiTreeUtil.getParentOfType(at, XQueryArgumentList.class);
}