LookupElementBuilder (@NotNull PsiMethod accessor, @Nullable PsiSubstitutor substitutor, @Nullable PrefixMatcher matcher) { String propName; PsiType propType; final boolean getter = GroovyPropertyUtils.isSimplePropertyGetter(accessor, null); if (getter) { propName = GroovyPropertyUtils.getPropertyNameByGetter(accessor); } else if (GroovyPropertyUtils.isSimplePropertySetter(accessor, null)) { propName = GroovyPropertyUtils.getPropertyNameBySetter(accessor); } else { return null; } assert propName != null; if (!PsiUtil.isValidReferenceName(propName)) { propName = "'" + propName + "'"; } if (matcher != null && !matcher.prefixMatches(propName)) { return null; } if (getter) { propType = PsiUtil.getSmartReturnType(accessor); } else { propType = accessor.getParameterList().getParameters()[0].getType(); } final PsiType substituted = substitutor != null ? substitutor.substitute(propType) : propType; LookupElementBuilder builder = LookupElementBuilder.create(generatePropertyElement(propName, accessor, propType), propName) .withIcon(JetgroovyIcons.Groovy.Property); if (substituted != null) { builder = builder.withTypeText(substituted.getPresentableText()); } return builder; }