Context (@Nullable PsiElement element) { if (element != null) { if (!(element instanceof PsiAssignmentExpression) && !(element instanceof PsiLocalVariable)) { element = element.getParent(); } if (element instanceof PsiAssignmentExpression assignment) { return getContext(findVariable(assignment), assignment); } if (element instanceof PsiLocalVariable variable) { return getContext(variable, findAssignment(variable)); } } return null; }