From a7535c7331721e3e0daeb6041de2fee54c61727f Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Mon, 31 Jul 2023 08:50:19 -0600 Subject: [PATCH] [Emacs] Add tree-sitter modes for python and typescript --- dotfiles/emacs.d/README.org | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/dotfiles/emacs.d/README.org b/dotfiles/emacs.d/README.org index 8ff01dab..1efb8e2d 100644 --- a/dotfiles/emacs.d/README.org +++ b/dotfiles/emacs.d/README.org @@ -2287,6 +2287,17 @@ I don't use auto-complete at all, so I have set up a hook to automatically disab (unbind-key "C-j" python-mode-map) (add-hook 'python-mode-hook #'imalison:python-mode))) #+END_SRC +**** tree-sitter +#+begin_src emacs-lisp +(use-package python-ts-mode + :ensure nil + :commands python-ts-mode + :mode ("\\.py\\'" . python-ts-mode) + :if (and (fboundp 'treesit-ready-p) (treesit-ready-p 'python)) + :init + (add-to-list 'treesit-language-source-alist + '(python "https://github.com/tree-sitter/tree-sitter-python/")))) +#+end_src *** go #+BEGIN_SRC emacs-lisp (use-package go-mode @@ -2760,6 +2771,25 @@ The following is taken from [[https://github.com/syl20bnr/spacemacs/blob/a650877 (progn (add-hook 'typescript-mode-hook 'lsp-deferred))) #+end_src +**** tree-sitter +#+begin_src emacs-lisp +(use-package typescript-ts-mode + :disabled t + :if (and (fboundp 'treesit-ready-p) (treesit-ready-p 'typescript)) + :ensure nil + :mode ("\\.ts\\'" "\\.tsx\\'") + :init + (progn + (add-to-list 'treesit-language-source-alist + '(typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" + "master" "typescript/src"))) + (add-to-list 'treesit-language-source-alist + '(tsx . ("https://github.com/tree-sitter/tree-sitter-typescript" + "master" "tsx/src")))) + :config + (progn + (add-hook 'typescript-mode-hoook 'lsp-deferred))) +#+end_src *** coffee script #+BEGIN_SRC emacs-lisp (use-package coffee-mode