void (Object o, @NotNull ParameterInfoUIContext context) { CodeInsightSettings settings = CodeInsightSettings.getInstance(); if (o == null) return; Object element; if (o instanceof GroovyResolveResult) { element = ((GroovyResolveResult)o).getElement(); if (element == null || !((PsiElement)element).isValid()) { context.setUIComponentEnabled(false); return; } } else if (o instanceof GrSignature) { if (!((GrSignature)o).isValid()) { context.setUIComponentEnabled(false); return; } element = o; } else { return; } int highlightStartOffset = -1; int highlightEndOffset = -1; final int currentParameter = context.getCurrentParameterIndex(); StringBuilder buffer = new StringBuilder(); if (element instanceof PsiMethod method) { if (method instanceof GrReflectedMethod) method = ((GrReflectedMethod)method).getBaseMethod(); if (settings.SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO) { if (!method.isConstructor()) { PsiType returnType = PsiUtil.getSmartReturnType(method); if (returnType != null) { buffer.append(returnType.getPresentableText()); buffer.append(' '); } } buffer.append(method.getName()); buffer.append('('); } PsiParameter[] params = method.getParameterList().getParameters(); params = updateConstructorParams(method, params, context.getParameterOwner()); int numParams = params.length; if (numParams > 0) { LOG.assertTrue(o instanceof GroovyResolveResult, o.getClass()); final PsiSubstitutor substitutor = ((GroovyResolveResult)o).getSubstitutor(); for (int j = 0; j < numParams; j++) { PsiParameter param = params[j]; int startOffset = buffer.length(); appendParameterText(param, substitutor, buffer); int endOffset = buffer.length(); if (j < numParams - 1) { buffer.append(", "); } if (context.isUIComponentEnabled() && (j == currentParameter || (j == numParams - 1 && param.isVarArgs() && currentParameter >= numParams))) { highlightStartOffset = startOffset; highlightEndOffset = endOffset; } } } else { buffer.append("no parameters"); } if (settings.SHOW_FULL_SIGNATURES_IN_PARAMETER_INFO) { buffer.append(")"); } } else if (element instanceof PsiClass) { buffer.append("no parameters"); } else if (element instanceof GrSignature) { GrClosureParameter[] parameters = ((GrSignature)element).getParameters(); if (parameters.length > 0) { for (int i = 0; i < parameters.length; i++) { if (i > 0) buffer.append(", "); int startOffset = buffer.length(); final PsiType psiType = parameters[i].getType(); if (psiType == null) { buffer.append("def"); } else { buffer.append(psiType.getPresentableText()); } buffer.append(' ').append(parameters[i].getName() != null ? parameters[i].getName() : "<unknown>"); int endOffset = buffer.length(); if (context.isUIComponentEnabled() && (i == currentParameter || (i == parameters.length - 1 && ((GrSignature)element).isVarargs() && currentParameter >= parameters.length))) { highlightStartOffset = startOffset; highlightEndOffset = endOffset; } final GrExpression initializer = parameters[i].getDefaultInitializer(); if (initializer != null) { buffer.append(" = ").append(initializer.getText()); } } } else { buffer.append("no parameters"); } } final boolean isDeprecated = o instanceof PsiDocCommentOwner && ((PsiDocCommentOwner) o).isDeprecated(); context.setupUIComponentPresentation( buffer.toString(), highlightStartOffset, highlightEndOffset, !context.isUIComponentEnabled(), isDeprecated, false, context.getDefaultParameterColor() ); }