boolean (PsiElement context) { if (isInfixOperatorPosition(context)) return false; if (isAfterForParameter(context)) return false; final PsiElement parent = context.getParent(); if (parent == null) return false; PsiElement previous = PsiImplUtil.realPrevious(parent.getPrevSibling()); if (parent instanceof GrReferenceElement && parent.getParent() instanceof GrArgumentList) { PsiElement prevSibling = context.getPrevSibling(); if (prevSibling != null && prevSibling.getNode() != null) { if (!TokenSets.DOTS.contains(prevSibling.getNode().getElementType())) { return true; } } else if (!(previous != null && GroovyTokenTypes.mAT.equals(previous.getNode().getElementType()))) { return true; } } if (GroovyCompletionUtil.isTupleVarNameWithoutTypeDeclared(context)) return true; if (previous != null && GroovyTokenTypes.mAT.equals(previous.getNode().getElementType())) { return false; } if (GroovyCompletionUtil.asSimpleVariable(context) || GroovyCompletionUtil.asTypedMethod(context) || GroovyCompletionUtil.asVariableInBlock(context) || asVariableAfterModifiers(context)) { return true; } if ((parent instanceof GrParameter && ((GrParameter)parent).getTypeElementGroovy() == null) || parent instanceof GrReferenceElement && !(parent.getParent() instanceof GrImportStatement) && !(parent.getParent() instanceof GrPackageDefinition) && !(parent.getParent() instanceof GrArgumentList)) { PsiElement prevSibling = context.getPrevSibling(); if (parent instanceof GrReferenceElement && prevSibling != null && prevSibling.getNode() != null) { ASTNode node = prevSibling.getNode(); return !TokenSets.DOTS.contains(node.getElementType()); } else { return true; } } if (PsiImplUtil.realPrevious(parent.getPrevSibling()) instanceof GrModifierList) { return true; } if (PsiImplUtil.realPrevious(context.getPrevSibling()) instanceof GrModifierList) { return true; } return parent instanceof GrExpression && parent.getParent() instanceof GroovyFile && GroovyCompletionUtil.isNewStatement(context, false); }