int (final @NotNull Document document, final int offset, FormattingMode mode) { return PostprocessReformattingAspect.getInstance(getProject()).disablePostprocessFormattingInside(() -> { final PsiDocumentManager documentManager = PsiDocumentManager.getInstance(myProject); documentManager.commitDocument(document); PsiFile file = documentManager.getPsiFile(document); if (file == null) return offset; return doAdjustLineIndentByOffset(file, offset, mode); }); }