From c7b8b4c510f81041da3f17fde71f1fb21dac5917 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Thu, 14 Sep 2023 15:47:30 -0400 Subject: [PATCH] Use go-mod-ts-mode. --- ansible/roles/emacs/files/elisp/lang-go.el | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ansible/roles/emacs/files/elisp/lang-go.el b/ansible/roles/emacs/files/elisp/lang-go.el index 93b8615..7040532 100644 --- a/ansible/roles/emacs/files/elisp/lang-go.el +++ b/ansible/roles/emacs/files/elisp/lang-go.el @@ -5,19 +5,25 @@ :pin manual :mode ( ("\\.go\\'" . go-ts-mode) - ("/go\\.mod\\'" . go-ts-mode) + ("/go\\.mod\\'" . go-mod-ts-mode) ) - :commands (go-mode go-ts-mode) + :commands (go-ts-mode go-mod-ts-mode) :hook ( (go-ts-mode . (lambda () (when-linux (eglot-ensure) ) - )) + )) + + (go-mod-ts-mode . (lambda () + (when-linux + (eglot-ensure) + ) + )) + ;; (before-save . lsp-format-buffer) ) :init - (add-to-list 'major-mode-remap-alist '(go-mode . go-ts-mode)) (add-to-list 'treesit-language-source-alist '(go "https://github.com/tree-sitter/tree-sitter-go")) (add-to-list 'treesit-language-source-alist '(gomod "https://github.com/camdencheek/tree-sitter-go-mod")) (unless (treesit-ready-p 'go) (treesit-install-language-grammar 'go))