private static void insertDocStringStub(Editor editor, PsiElement element, DocstringState state) {
    PyAstDocStringOwner docOwner = PsiTreeUtil.getParentOfType(element, PyAstDocStringOwner.class);
    if (docOwner != null) {
      final int caretOffset = editor.getCaretModel().getOffset();
      final Document document = editor.getDocument();
      final String quotes = document.getText(TextRange.from(caretOffset - 3, 3));
      final String docString = PyDocstringGenerator.forDocStringOwner(docOwner)
        .withInferredParameters(true)
        .withQuotes(quotes)
        .forceNewMode()
        .buildDocString();
      if (state == DocstringState.INCOMPLETE) {
        document.insertString(caretOffset, docString.substring(3));
      }
      else if (state == DocstringState.EMPTY) {
        document.replaceString(caretOffset, caretOffset + 3, docString.substring(3));
      }
    }
  }
private static void insertDocStringStub(Editor editor, PsiElement element, DocstringState state)