PsiElement (PsiElement element) { PsiElement toHighlight = null; if (element instanceof GrReferenceExpression) { PsiElement parent = element.getParent(); if (parent instanceof GrAssignmentExpression) { toHighlight = ((GrAssignmentExpression)parent).getLValue(); } if (parent instanceof GrUnaryExpression && ((GrUnaryExpression)parent).isPostfix()) { toHighlight = parent; } } else if (element instanceof GrVariable) { toHighlight = ((GrVariable)element).getNameIdentifierGroovy(); } if (toHighlight == null) toHighlight = element; return toHighlight; }