Function: php-ts-mode-set-comment-style

php-ts-mode-set-comment-style is an interactive and byte-compiled function defined in php-ts-mode.el.gz.

Signature

(php-ts-mode-set-comment-style)

Documentation

Set a different comment style.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/progmodes/php-ts-mode.el.gz
;;; Modes

(defun php-ts-mode-set-comment-style ()
  "Set a different comment style."
  (interactive)
  (let ((lang (treesit-language-at (point))))
    (when (or (eq lang 'php) (eq lang 'phpdoc))
      (setq-local comment-start
		  (completing-read
		   "Choose comment style: "
		   '("/**" "// " "/*" "# ") nil t nil nil "// "))
      (cond
       ((equal comment-start "/*") (setq-local comment-end "*/"))
       ((equal comment-start "// ") (setq-local comment-end ""))
       ((equal comment-start "# ") (setq-local comment-end ""))
       ((equal comment-start "/**") (setq-local comment-end "*/")))
      ;; store the value in order to recover when switch to php from other languages.
      (plist-put php-ts-mode--comment-current-plist :comment-start comment-start)
      (plist-put php-ts-mode--comment-current-plist :comment-end comment-end))))