com.intellij.lang.parameterInfo.ParameterInfoUtils Java Examples

The following examples show how to use com.intellij.lang.parameterInfo.ParameterInfoUtils. 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: ORParameterInfoHandlerWithTabActionSupport.java    From reasonml-idea-plugin with MIT License 5 votes vote down vote up
@Override
public void updateParameterInfo(@NotNull PsiFunctionCallParams paramsOwner, @NotNull UpdateParameterInfoContext context) {
    if (context.getParameterOwner() == null || paramsOwner.equals(context.getParameterOwner())) {
        context.setParameterOwner(paramsOwner);
        context.setCurrentParameter(
                ParameterInfoUtils.getCurrentParameterIndex(paramsOwner.getNode(), context.getOffset(), getActualParameterDelimiterType()));
    } else {
        context.removeHint();
    }
}
 
Example #2
Source File: CSharpParameterInfoHandler.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Override
public void updateParameterInfo(@Nonnull PsiElement place, UpdateParameterInfoContext context)
{
	CSharpCallArgumentListOwner owner = resolveCallArgumentListOwner(place);
	int parameterIndex = -1;
	CSharpCallArgumentList callArgumentList = owner == null ? null : owner.getParameterList();
	if(callArgumentList != null)
	{
		IElementType delimiter = CSharpTokens.COMMA;
		if(callArgumentList instanceof CSharpDictionaryInitializerImpl)
		{
			delimiter = CSharpTokens.EQ;
		}
		parameterIndex = ParameterInfoUtils.getCurrentParameterIndex(callArgumentList.getNode(), context.getOffset(), delimiter);
	}

	context.setCurrentParameter(parameterIndex);

	if(context.getParameterOwner() == null)
	{
		context.setParameterOwner(place);
	}
	else if(context.getParameterOwner() != owner)
	{
		context.removeHint();
		return;
	}
	final Object[] objects = context.getObjectsToView();

	for(int i = 0; i < objects.length; i++)
	{
		context.setUIComponentEnabled(i, true);
	}
}
 
Example #3
Source File: CSharpGenericParameterInfoHandler.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Override
public void updateParameterInfo(@Nonnull PsiElement place, UpdateParameterInfoContext context)
{
	int parameterIndex = -1;
	DotNetTypeList typeList = PsiTreeUtil.getParentOfType(place, DotNetTypeList.class, false);

	if(typeList == null)
	{
		context.removeHint();
		return;
	}
	if(!(typeList.getParent() instanceof CSharpReferenceExpression))
	{
		context.removeHint();
		return;
	}

	parameterIndex = ParameterInfoUtils.getCurrentParameterIndex(typeList.getNode(), context.getOffset(), CSharpTokens.COMMA);

	context.setCurrentParameter(parameterIndex);

	if(context.getParameterOwner() == null)
	{
		context.setParameterOwner(place);
	}
	else if(context.getParameterOwner() != PsiTreeUtil.getParentOfType(place, CSharpReferenceExpression.class, false))
	{
		context.removeHint();
		return;
	}
	final Object[] objects = context.getObjectsToView();

	for(int i = 0; i < objects.length; i++)
	{
		context.setUIComponentEnabled(i, true);
	}
}
 
Example #4
Source File: XQueryParameterInfoHandler.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
@Override
public void updateParameterInfo(@NotNull XQueryArgumentList place, UpdateParameterInfoContext context) {
    context.setCurrentParameter(ParameterInfoUtils.getCurrentParameterIndex(place.getNode(), context.getOffset(),
            XQueryTypes.COMMA));
}
 
Example #5
Source File: XQueryParameterInfoHandler.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public String getParameterCloseChars() {
    return ParameterInfoUtils.DEFAULT_PARAMETER_CLOSE_CHARS;
}