Commit fceb60609db1

Vincent Demeester <vincent@sbr.pm>
2026-02-05 16:28:47
feat(emacs): add JavaScript and TypeScript ts-mode support
Added tree-sitter modes for JS/TS with eglot integration and file associations. Removed typescript-mode package since built-in typescript-ts-mode is now used instead. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent ce19a27
Changed files (2)
dots
config
emacs
home
common
dots/config/emacs/init.el
@@ -739,11 +739,17 @@ minibuffer, even without explicitly focusing it."
   (sh-mode . eglot-ensure-unless-tramp)
   (sh-script-mode . eglot-ensure-unless-tramp)
   (org-mode . eglot-ensure-unless-tramp)
-  (markdown-mode . eglot-ensure-unless-tramp))
+  (markdown-mode . eglot-ensure-unless-tramp)
+  (js-ts-mode . eglot-ensure-unless-tramp)
+  (typescript-ts-mode . eglot-ensure-unless-tramp)
+  (tsx-ts-mode . eglot-ensure-unless-tramp))
 
 (setq major-mode-remap-alist
       '((python-mode . python-ts-mode)
-	(go-mode . go-ts-mode)))
+	(go-mode . go-ts-mode)
+	(javascript-mode . js-ts-mode)
+	(js-mode . js-ts-mode)
+	(typescript-mode . typescript-ts-mode)))
 
 (use-package markdown-mode
   :mode (("README\\.md\\'" . gfm-mode)
@@ -800,6 +806,19 @@ minibuffer, even without explicitly focusing it."
   :if (executable-find "terraform-ls")
   :mode ("\\.tf\\'" "\\.tfvars\\'"))
 
+(use-package js-ts-mode
+  :mode (("\\.js\\'" . js-ts-mode)
+         ("\\.mjs\\'" . js-ts-mode)
+         ("\\.cjs\\'" . js-ts-mode)))
+
+(use-package typescript-ts-mode
+  :mode (("\\.ts\\'" . typescript-ts-mode)
+         ("\\.mts\\'" . typescript-ts-mode)
+         ("\\.cts\\'" . typescript-ts-mode)))
+
+(use-package tsx-ts-mode
+  :mode ("\\.tsx\\'" "\\.jsx\\'"))
+
 (use-package nix-drv-mode
   :if (executable-find "nix")
   :after nix-mode
home/common/dev/emacs.nix
@@ -153,7 +153,6 @@ let
       trashed
       treesit-fold
       treesit-grammars.with-all-grammars # see how much it weight
-      typescript-mode
       # vc-jj
       verb
       # vertico