Closed ianyepan closed 5 years ago
If you use any tools that rely on the js2 AST (like js2-refactor) or mocha.el, then you still need to use RJSX. More details in mooz/js2-mode#527
Thanks for the reply, but as a newcomer in coding JS in Emacs (I used to heavily rely on VSCode since everything just worked OOTB), I found it kinda overwhelming to see js-mode, js-jsx-mode, js2-mode, js2-jsx-mode, js3-mode, rjsx-mode, web-mode etc...
On top of that, I use Tide (tsserver) to provide me with intelligent code actions. But I don't quite understand the major modes yet.
P.s. here's my current setup on both Emacs 26.2 and 27:
(use-package tide
:after (company flycheck)
:config
(define-key tide-mode-map (kbd "s-b") 'tide-jump-to-definition)
(define-key tide-mode-map (kbd "s-[") 'tide-jump-back))
(use-package rjsx-mode
:mode ("\\.jsx?$" . rjsx-mode)
:hook (rjsx-mode . tide-setup)
:config (setq js-indent-level 2
js2-strict-missing-semi-warning nil))
(use-package web-mode
:mode
("\\.html?$". web-mode)
("\\.css$". web-mode)
("\\.tsx$". web-mode)
:config
(defun my/tsx-setup ()
(when (and (stringp buffer-file-name)
(string-match "\\.tsx$" buffer-file-name))
(tide-setup)))
(add-hook 'web-mode-hook 'my/tsx-setup))
I haven't used the new js mode, so can't offer an opinion there, sorry!
i see, thanks for the reply still. No matter what rjsx still has the best syntax highlighting IME.
After having tested again embedded support of JSX in Emacs 28.2, I go back to RJSX-mode which still works better out of box for commenting JSX parts (and even after a configuration effort).
As titled.