aboutsummaryrefslogtreecommitdiff
path: root/emacs
diff options
context:
space:
mode:
authorAlex <alex.corcoles@veecle.io>2025-07-18 17:16:37 +0200
committeralexpdp7 <alex@corcoles.net>2025-07-18 17:18:46 +0200
commitb5593641a4078a57a5692034149510b8dca12058 (patch)
tree91e6153c6e348ad7a17b4af6b50f3980f7342789 /emacs
parent371c20f78dac78b53a499b21342b611e326c8a98 (diff)
Add support for TypeScript and TSX
Diffstat (limited to 'emacs')
-rw-r--r--emacs/emacs.el15
1 files changed, 15 insertions, 0 deletions
diff --git a/emacs/emacs.el b/emacs/emacs.el
index 370ce9b2..d372028f 100644
--- a/emacs/emacs.el
+++ b/emacs/emacs.el
@@ -107,6 +107,21 @@
(setq auto-mode-alist (append '(("\\.pl\\'" . prolog-mode))
auto-mode-alist))
+;; for typescript and tsx, use treesit-install-language-grammar to enable the built-in Emacs modes; interactive install is fine, see https://www.masteringemacs.org/article/how-to-get-started-tree-sitter
+(add-hook 'tsx-ts-mode-hook 'eglot-ensure)
+(add-hook 'typescript-ts-mode-hook 'eglot-ensure)
+
+(with-eval-after-load 'eglot
+ (add-to-list 'eglot-server-programs
+ '(tsx-ts-mode . ("npx" "typescript-language-server" "--stdio"))))
+
+(with-eval-after-load 'eglot
+ (add-to-list 'eglot-server-programs
+ '(typescript-ts-mode . ("npx" "typescript-language-server" "--stdio"))))
+
+(add-to-list 'auto-mode-alist '("\\.ts" . typescript-ts-mode))
+(add-to-list 'auto-mode-alist '("\\.tsx" . tsx-ts-mode))
+
(use-package sql-indent
:ensure t
:config