emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Commenting out some JSX code section with Emacs 27 js-mode


From: Christian Jauvin
Subject: Re: Commenting out some JSX code section with Emacs 27 js-mode
Date: Fri, 2 Oct 2020 17:01:08 -0400

(add-hook 'js-mode-hook
          (lambda ()
            (setq-local comment-start "{/* ")
            (setq-local comment-end   " */}")))

It now works for JSX, but breaks on regular JS code (inside the same .jsx file):

const [open, setOpen] = React.useState(false);
const [options, setOptions] = React.useState([]);

becomes:

{/* const [open, setOpen] = React.useState(false); */}
{/* const [options, setOptions] = React.useState([]); */}

Would there be a way for the comment function to know whether it is in a JSX block or not, and act accordingly?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]