void (PsiElement context, GroovyCompletionConsumer result) { final PsiElement parent = context.getParent(); if (GroovyCompletionUtil.isWildcardCompletion(context)) return; if (parent instanceof GrVariable variable) { if (context.equals(variable.getNameIdentifierGroovy())) { final PsiType type = variable.getTypeGroovy(); if (type != null) { final JavaCodeStyleManager codeStyleManager = JavaCodeStyleManager.getInstance(context.getProject()); VariableKind kind = variable instanceof GrParameter ? VariableKind.PARAMETER : variable instanceof GrField ? VariableKind.FIELD : VariableKind.LOCAL_VARIABLE; SuggestedNameInfo suggestedNameInfo = codeStyleManager.suggestVariableName(kind, null, null, type); String[] names = suggestedNameInfo.names; if (names.length > 0) { String name = names[0]; String newName = InlineMethodConflictSolver.suggestNewName(name, null, parent); if (!name.equals(newName)) { result.consume(LookupElementBuilder.create(newName)); return; } } for (String name : names) { result.consume(LookupElementBuilder.create(name)); } } GrExpression initializer = variable.getInitializerGroovy(); if (initializer != null) { for (String name : GroovyNameSuggestionUtil.suggestVariableNames(initializer, new DefaultGroovyVariableNameValidator(variable), variable.hasModifierProperty(PsiModifier.STATIC))) { result.consume(LookupElementBuilder.create(name)); } } } } }