Skip to content

Commit 352c6d5

Browse files
committed
Implement experimental TSX-support via tree-sitter, if available.
Implement support using recipe suggested by @josemiguelo in this comment: #4 (comment)
1 parent c9b22f5 commit 352c6d5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

typescript-mode.el

+11
Original file line numberDiff line numberDiff line change
@@ -2980,6 +2980,17 @@ Key bindings:
29802980
;;;###autoload
29812981
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))
29822982

2983+
;;;###autoload
2984+
(ignore-errors
2985+
;; experimental TSX-support via tree-sitter, if available
2986+
(require 'tree-sitter)
2987+
(require 'tree-sitter-langs)
2988+
(define-derived-mode typescript-tsx-mode typescript-mode "tsx")
2989+
(add-hook typescript-tsx-mode-hook #'tree-sitter-hl-mode)
2990+
(add-to-list 'tree-sitter-major-mode-language-alist '(typescript-tsx-mode . tsx))
2991+
(add-to-list 'auto-mode-alist '("\\.tsx?\\'" . typescript-tsx-mode)))
2992+
2993+
29832994
(provide 'typescript-mode)
29842995

29852996
;;; typescript-mode.el ends here

0 commit comments

Comments
 (0)