Result (@NotNull PsiFile file, @NotNull Editor editor, @NotNull DataContext dataContext) { final PsiSnippetDocTag host = getHost(file, editor); if (host == null) return Result.Continue; final Editor hostEditor = ((EditorWindow)editor).getDelegate(); final Document hostDocument = hostEditor.getDocument(); final CaretModel caretModelHost = hostEditor.getCaretModel(); int caretOffsetHost = caretModelHost.getOffset(); final int lineStartOffset = DocumentUtil.getLineStartOffset(caretOffsetHost, hostDocument); int firstNonWsLineOffset = CharArrayUtil.shiftForward(hostDocument.getText(), lineStartOffset, " \t"); if (hostDocument.getText().charAt(firstNonWsLineOffset) != '*') { final String prefix = calcPrefix(host); hostDocument.insertString(lineStartOffset, prefix); caretModelHost.moveToOffset(caretOffsetHost + prefix.length()); EditorModificationUtilEx.scrollToCaret(editor); } return Result.Default; }