From cfef8c9a4a04c2bb3fa967747b3abc78c84937c7 Mon Sep 17 00:00:00 2001 From: kj Date: Fri, 7 Feb 2025 17:40:49 -0300 Subject: [PATCH] Add typescript base config. --- configs/init-packages.el | 2 ++ configs/lang-js.el | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/configs/init-packages.el b/configs/init-packages.el index a9bcaf4..2c0ab66 100644 --- a/configs/init-packages.el +++ b/configs/init-packages.el @@ -402,6 +402,8 @@ (rust . ("https://github.com/tree-sitter/tree-sitter-rust")) (sql . ("https://github.com/m-novikov/tree-sitter-sql")) (toml . ("https://github.com/tree-sitter/tree-sitter-toml")) + (tsx . ("https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")) + (typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")) (zig . ("https://github.com/GrayJack/tree-sitter-zig")))) (defun nf/treesit-install-all-languages () "Install all languages specified by `treesit-language-source-alist'." diff --git a/configs/lang-js.el b/configs/lang-js.el index 9336a49..6bcd83e 100644 --- a/configs/lang-js.el +++ b/configs/lang-js.el @@ -14,8 +14,13 @@ :ensure nil :mode ("\\.js$" . js-mode) + :init + (add-to-list 'auto-mode-alist '("\\.tsx\\'" . tsx-ts-mode)) + (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode)) :hook - (js-mode . eglot-ensure) + ((js-mode . eglot-ensure) + (tsx-ts-mode . eglot-ensure) + (typescript-ts-mode . eglot-ensure)) :config (setq js-indent-level 2))