]> git.eshelyaron.com Git - emacs.git/commitdiff
Make typescript-ts-mode not fallback to js-mode
authorYuan Fu <casouri@gmail.com>
Sat, 26 Nov 2022 23:32:57 +0000 (15:32 -0800)
committerYuan Fu <casouri@gmail.com>
Sat, 26 Nov 2022 23:40:25 +0000 (15:40 -0800)
1. js-mode might not be able to handle typescript file
2. Now that we use separate modes for tree-sitter modes, not falling
back makes tree-sitter modes more consistent

* lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): Remove
the fallback code.

lisp/progmodes/typescript-ts-mode.el

index c7b332c61495c159048e113c3090849ab7b834c1..8a9d540bd3c3fd603ee403bbaef15f4720f693cb 100644 (file)
   :group 'typescript
   :syntax-table typescript-ts-mode--syntax-table
 
-  (cond
-   ;; `typescript-ts-mode' requires tree-sitter to work, so we don't check if
-   ;; user enables tree-sitter for it.
-   ((treesit-ready-p 'tsx)
-    ;; Tree-sitter.
+  (when (treesit-ready-p 'tsx)
     (treesit-parser-create 'tsx)
 
     ;; Comments.
     ;; Which-func (use imenu).
     (setq-local which-func-functions nil)
 
-    (treesit-major-mode-setup))
+    (treesit-major-mode-setup)))
 
-   ;; Elisp.
-   (t
-    (js-mode)
-    (message "Tree-sitter for TypeScript isn't available, falling back to `js-mode'"))))
 
 (provide 'typescript-ts-mode)