1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-23 18:47:57 +00:00

Comment JSX lines using JSX syntax

* lisp/progmodes/js.el (js-jsx--comment-region): New function
(bug#41696).
(js-jsx-mode): Use it.
This commit is contained in:
Lars Ingebrigtsen 2020-10-22 15:20:04 +02:00
parent 0d7d09b0ef
commit 45c1be62a1

View File

@ -4656,8 +4656,19 @@ could set `js-jsx-syntax' to t in your init file, or in a
one of the aforementioned options instead of using this mode."
:group 'js
(js-jsx-enable)
(setq-local comment-region-function #'js-jsx--comment-region)
(js-use-syntactic-mode-name))
(defun js-jsx--comment-region (beg end &optional arg)
(if (or (js-jsx--context)
(save-excursion
(skip-chars-forward " \t")
(js-jsx--looking-at-start-tag-p)))
(let ((comment-start "{/* ")
(comment-end " */}"))
(comment-region-default beg end arg))
(comment-region-default beg end arg)))
;;;###autoload (defalias 'javascript-mode 'js-mode)
(eval-after-load 'folding