Function: go-ts-mode-docstring

go-ts-mode-docstring is an interactive and byte-compiled function defined in go-ts-mode.el.gz.

Signature

(go-ts-mode-docstring)

Documentation

Add a docstring comment for the current defun.

The added docstring is prefilled with the defun's name. If the comment already exists, jump to it.

Probably introduced at or before Emacs version 30.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/go-ts-mode.el.gz
(defun go-ts-mode-docstring ()
  "Add a docstring comment for the current defun.
The added docstring is prefilled with the defun's name.  If the
comment already exists, jump to it."
  (interactive)
  (when-let* ((defun-node (treesit-defun-at-point)))
    (goto-char (treesit-node-start defun-node))
    (if (go-ts-mode--comment-on-previous-line-p)
        ;; go to top comment line
        (while (go-ts-mode--comment-on-previous-line-p)
          (forward-line -1))
      (insert "// " (go-ts-mode--defun-name defun-node t))
      (newline)
      (backward-char))))