From f5fc0136272d28c8e046b285ffb7da1f362defac Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 2 Sep 2023 18:59:08 +0200 Subject: emacs: Add Go tree-sitter support --- .config/emacs/config.org | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to '.config/emacs/config.org') diff --git a/.config/emacs/config.org b/.config/emacs/config.org index a06f592..4c39ec3 100644 --- a/.config/emacs/config.org +++ b/.config/emacs/config.org @@ -763,6 +763,7 @@ already installed unfortunately, but it’s easy enough to do manually. (css "https://github.com/tree-sitter/tree-sitter-css") (elisp "https://github.com/Wilfred/tree-sitter-elisp") (go "https://github.com/tree-sitter/tree-sitter-go") + (go-mod "https://github.com/camdencheek/tree-sitter-go-mod.git") (html "https://github.com/tree-sitter/tree-sitter-html") (json "https://github.com/tree-sitter/tree-sitter-json") (make "https://github.com/alemuller/tree-sitter-make") @@ -771,6 +772,9 @@ already installed unfortunately, but it’s easy enough to do manually. (toml "https://github.com/tree-sitter/tree-sitter-toml") (yaml "https://github.com/ikatyang/tree-sitter-yaml"))) + (setq treesit-load-name-override-list + '((go-mod "libtree-sitter-go-mod" "tree_sitter_gomod"))) + ;; Automatically install missing grammars (thread-last (mapcar #'car treesit-language-source-alist) @@ -1160,10 +1164,12 @@ file with a certain file extension. #+BEGIN_SRC elisp + (require 'go-ts-mode) (require 'rust-ts-mode) (require 'yaml-ts-mode) - (dolist (pair '(("\\.py\\'" . python-ts-mode) + (dolist (pair '(("\\.go\\'" . go-ts-mode) + ("\\.py\\'" . python-ts-mode) ("\\.rs\\'" . rust-ts-mode) ("\\.ya?ml\\'" . yaml-ts-mode))) (add-to-list 'auto-mode-alist pair)) -- cgit v1.2.3