void (@NotNull PsiFile file, @NotNull Editor editor, int offset) { final Document document = editor.getDocument(); PsiDocumentManager.getInstance(file.getProject()).commitDocument(document); final PsiElement element = file.findElementAt(offset); if (element != null) { // Insert additional indentation after section header in Google code style docstrings final PyStringLiteralExpression pyString = DocStringUtil.getParentDefinitionDocString(element); if (pyString != null) { final String docStringText = pyString.getText(); final DocStringFormat format = DocStringUtil.guessDocStringFormat(docStringText, pyString); if (format == DocStringFormat.GOOGLE && offset + 1 < document.getTextLength()) { final int lineNum = document.getLineNumber(offset); final TextRange lineRange = TextRange.create(document.getLineStartOffset(lineNum - 1), document.getLineEndOffset(lineNum - 1)); final Matcher matcher = GoogleCodeStyleDocString.SECTION_HEADER.matcher(document.getText(lineRange)); if (matcher.matches() && SectionBasedDocString.isValidSectionTitle(matcher.group(1))) { document.insertString(offset, GoogleCodeStyleDocStringBuilder.getDefaultSectionIndent(file)); editor.getCaretModel().moveCaretRelatively(2, 0, false, false, false); } } } } }