com.intellij.lang.parameterInfo.UpdateParameterInfoContext Java Examples

The following examples show how to use com.intellij.lang.parameterInfo.UpdateParameterInfoContext. 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
@Nullable
@Override
public PsiFunctionCallParams findElementForUpdatingParameterInfo(@NotNull UpdateParameterInfoContext context) {
    PsiFunctionCallParams paramsOwner = findFunctionParams(context.getFile(), context.getOffset());
    if (paramsOwner != null) {
        PsiElement currentOwner = context.getParameterOwner();
        if (currentOwner == null || currentOwner == paramsOwner) {
            return paramsOwner;
        }
    }

    return null;
}
 
Example #2
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 #3
Source File: CSharpParameterInfoHandler.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nullable
@Override
@RequiredReadAction
public PsiElement findElementForUpdatingParameterInfo(UpdateParameterInfoContext context)
{
	return context.getFile().findElementAt(context.getEditor().getCaretModel().getOffset());
}
 
Example #4
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 #5
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 #6
Source File: CSharpGenericParameterInfoHandler.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public PsiElement findElementForUpdatingParameterInfo(UpdateParameterInfoContext context)
{
	return context.getFile().findElementAt(context.getEditor().getCaretModel().getOffset());
}
 
Example #7
Source File: XQueryParameterInfoHandler.java    From intellij-xquery with Apache License 2.0 4 votes vote down vote up
@Nullable
@Override
public XQueryArgumentList findElementForUpdatingParameterInfo(UpdateParameterInfoContext context) {
    return getArgumentList(context);
}
 
Example #8
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));
}