diff options
| author | Alex <alex.corcoles@veecle.io> | 2025-07-18 17:16:37 +0200 |
|---|---|---|
| committer | alexpdp7 <alex@corcoles.net> | 2025-07-18 17:18:46 +0200 |
| commit | b5593641a4078a57a5692034149510b8dca12058 (patch) | |
| tree | 91e6153c6e348ad7a17b4af6b50f3980f7342789 | |
| parent | 371c20f78dac78b53a499b21342b611e326c8a98 (diff) | |
Add support for TypeScript and TSX
| -rw-r--r-- | emacs/emacs.el | 15 |
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 |
