PsiElement (@NotNull ReplacementInfo info) { final PsiElement element = info.getMatch(0); if (element==null || !element.isWritable() || !element.isValid()) return null; final PsiElement elementParent = StructuralSearchUtil.getPresentableElement(element).getParent(); CodeStyleManager.getInstance(project).performActionWithFormatterDisabled( (Runnable)() -> replaceHandler.replace(info, options) ); if (!elementParent.isValid() || !elementParent.isWritable()) { return null; } return elementParent; }