aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuan Fu2022-11-26 15:32:57 -0800
committerYuan Fu2022-11-26 15:40:25 -0800
commita3d8da24762bc7ecc5bad9275ecc0a6d5f3ac7c3 (patch)
tree7a868ec27d357e091decee61abbc1d96c1fd960d
parent3fe5fc3dc164fbc12c7716d6b5430f2b85833290 (diff)
downloademacs-a3d8da24762bc7ecc5bad9275ecc0a6d5f3ac7c3.tar.gz
emacs-a3d8da24762bc7ecc5bad9275ecc0a6d5f3ac7c3.zip
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.
-rw-r--r--lisp/progmodes/typescript-ts-mode.el12
1 files changed, 2 insertions, 10 deletions
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el
index c7b332c6149..8a9d540bd3c 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -289,11 +289,7 @@
289 :group 'typescript 289 :group 'typescript
290 :syntax-table typescript-ts-mode--syntax-table 290 :syntax-table typescript-ts-mode--syntax-table
291 291
292 (cond 292 (when (treesit-ready-p 'tsx)
293 ;; `typescript-ts-mode' requires tree-sitter to work, so we don't check if
294 ;; user enables tree-sitter for it.
295 ((treesit-ready-p 'tsx)
296 ;; Tree-sitter.
297 (treesit-parser-create 'tsx) 293 (treesit-parser-create 'tsx)
298 294
299 ;; Comments. 295 ;; Comments.
@@ -330,12 +326,8 @@
330 ;; Which-func (use imenu). 326 ;; Which-func (use imenu).
331 (setq-local which-func-functions nil) 327 (setq-local which-func-functions nil)
332 328
333 (treesit-major-mode-setup)) 329 (treesit-major-mode-setup)))
334 330
335 ;; Elisp.
336 (t
337 (js-mode)
338 (message "Tree-sitter for TypeScript isn't available, falling back to `js-mode'"))))
339 331
340(provide 'typescript-ts-mode) 332(provide 'typescript-ts-mode)
341 333