Skip to content

Commit 7675bab

Browse files
committed
Add .tsx to auto-mode-alist
Add out-of-the-box support for using typescript-mode on *.tsx files. Avoids repetitive manual configuration for end users.
1 parent 2e66d8e commit 7675bab

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

typescript-mode-general-tests.el

+8
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,14 @@
1818
(indent-region (point-min) (point-max) nil)
1919
(untabify (point-min) (point-max)))
2020

21+
(ert-deftest auto-mode-alist-ts ()
22+
(find-file (make-temp-file load-file-name nil ".ts"))
23+
(should (string-equal "typescript-mode" major-mode)))
24+
25+
(ert-deftest auto-mode-alist-tsx ()
26+
(find-file (make-temp-file load-file-name nil ".tsx"))
27+
(should (string-equal "typescript-mode" major-mode)))
28+
2129
(ert-deftest indentation-reference-document-is-reflowed-correctly ()
2230
(with-temp-buffer
2331
(insert-file-contents "test-files/indentation-reference-document.ts")

typescript-mode.el

+1-1
Original file line numberDiff line numberDiff line change
@@ -3119,7 +3119,7 @@ Key bindings:
31193119
(folding-add-to-marks-list 'typescript-mode "// {{{" "// }}}" )))
31203120

31213121
;;;###autoload
3122-
(add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-mode))
3122+
(add-to-list 'auto-mode-alist '("\\.tsx?\\'" . typescript-mode))
31233123

31243124
(provide 'typescript-mode)
31253125

0 commit comments

Comments
 (0)