Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions langs/docstr-python.el
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,16 @@
(defun docstr-trigger-python (&rest _)
"Trigger document string inside Python."
(when (and (memq major-mode docstr-python-modes)
;; TODO: For some reason, '(nth 4 (syntax-ppss))' doesn't work.
docstr-mode
(docstr-util-looking-back "\"\"\"" 3)
(looking-at-p "\"\"\""))
;; This should avoid pairing plugins inserting document string
;; twice by accident. e.g. `electric-pair-mode', `smartparens',
;; etc.
;;
;; See #5.
(not (docstr-util-looking-back "\"\"\"\"" 4)))
;; If no pairing, help complete it!
(unless (looking-at-p "\"\"\"") (save-excursion (insert "\"\"\"")))
(docstr--insert-doc-string (docstr-python--parse))))

(provide 'docstr-python)
Expand Down