[Emacs] Add tree-sitter modes for python and typescript

This commit is contained in:
Ivan Malison 2023-07-31 08:50:19 -06:00
parent 1ad79fd7e6
commit a7535c7331

View File

@ -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) (unbind-key "C-j" python-mode-map)
(add-hook 'python-mode-hook #'imalison:python-mode))) (add-hook 'python-mode-hook #'imalison:python-mode)))
#+END_SRC #+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 *** go
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package go-mode (use-package go-mode
@ -2760,6 +2771,25 @@ The following is taken from [[https://github.com/syl20bnr/spacemacs/blob/a650877
(progn (progn
(add-hook 'typescript-mode-hook 'lsp-deferred))) (add-hook 'typescript-mode-hook 'lsp-deferred)))
#+end_src #+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 *** coffee script
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package coffee-mode (use-package coffee-mode