void (Ref<PsiComment> commentRef, CodeStyleManager codeStyleManager) { PsiComment comment = commentRef.get(); RangeMarker commentMarker = myDocument.createRangeMarker(comment.getTextRange().getStartOffset(), comment.getTextRange().getEndOffset()); codeStyleManager.reformatNewlyAddedElement(comment.getNode().getTreeParent(), comment.getNode()); commentRef.set(PsiTreeUtil.getNonStrictParentOfType(myFile.findElementAt(commentMarker.getStartOffset()), PsiComment.class)); commentMarker.dispose(); }