void (@NotNull Template template, boolean brokenOff) { PsiDocumentManager.getInstance(project).commitDocument(newEditor.getDocument()); final int offset = newEditor.getCaretModel().getOffset(); final PsiField psiField = PsiTreeUtil.findElementOfClassAtOffset(targetFile, offset, PsiField.class, false); if (psiField != null) { ApplicationManager.getApplication().runWriteAction(() -> { CodeStyleManager.getInstance(project).reformat(psiField); }); newEditor.getCaretModel().moveToOffset(psiField.getTextRange().getEndOffset() - 1); } }