boolean (PsiExpression expression) { if (!(expression instanceof PsiReferenceExpression ref)) return false; PsiExpression qualifier = ref.getQualifierExpression(); if (qualifier != null) { if (!(qualifier instanceof PsiQualifiedExpression) || ((PsiQualifiedExpression)qualifier).getQualifier() != null) return false; } return ref.resolve() instanceof PsiVariable; }