fix(emacs): create typescript-tsx-mode

When editing typescript jsx files I was previously using rjsx-mode to
get the jsx highlighting and emmet `className` support. This now
splits out the tsx to ts like other packages like spacemacs and doom
do. This gives me better jsx support with typescript and not impacting
the ts mode that dose not play nicely with jsx.

This seems to be working better with the snippets I created for
spacemacs that works with rjsx-mode and override any functions that
need it for typescript-tsx-mode
This commit is contained in:
Ade Attwood 2021-05-01 14:26:21 +01:00
parent 3c2b34e98f
commit e48e616c6e
2 changed files with 7 additions and 4 deletions

View file

@ -46,8 +46,11 @@
(use-package typescript-mode
:hook (typescript-mode . lsp-deferred)
:mode
(("\\.ts\\'" . typescript-mode)
("\\.tsx\\'" . typescript-mode)))
:mode (("\\.ts\\'" . typescript-mode)))
(progn
(define-derived-mode typescript-tsx-mode web-mode "TypeScript-tsx")
(add-to-list 'auto-mode-alist '("\\.tsx\\'" . typescript-tsx-mode))
(add-hook 'typescript-tsx-mode-hook 'lsp-deferred))
(use-package prettier-js :commands prettier-js)

View file

@ -58,7 +58,7 @@
(rjsx-mode . (lambda ()
(emmet-mode)
(setq-local emmet-expand-jsx-className? t)))
(typescript-mode . (lambda ()
(typescript-tsx-mode . (lambda ()
(emmet-mode)
(setq-local emmet-expand-jsx-className? t)))))