void (@NotNull PsiReferenceExpression expression) { final PsiElement resolved = expression.resolve(); if (PsiUtil.isJvmLocalVariable(resolved)) { PsiVariable variable = (PsiVariable) resolved; final LocalSearchScope useScope = (LocalSearchScope)variable.getUseScope(); if (!useScope.containsRange(newExpressionContainingFile, newExpressionTextRange)) { isReplaceable[0] = false; } } }