emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master a3d8da2476 7/7: Make typescript-ts-mode not fallback to js-mode


From: Yuan Fu
Subject: master a3d8da2476 7/7: Make typescript-ts-mode not fallback to js-mode
Date: Sat, 26 Nov 2022 21:36:30 -0500 (EST)

branch: master
commit a3d8da24762bc7ecc5bad9275ecc0a6d5f3ac7c3
Author: Yuan Fu <casouri@gmail.com>
Commit: Yuan Fu <casouri@gmail.com>

    Make typescript-ts-mode not fallback to js-mode
    
    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 | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/lisp/progmodes/typescript-ts-mode.el 
b/lisp/progmodes/typescript-ts-mode.el
index c7b332c614..8a9d540bd3 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -289,11 +289,7 @@
   :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.
@@ -330,12 +326,8 @@
     ;; 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)
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]