-
-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add optional support for tree-sitter #396
Comments
Now tree-sitter is built-in in the new Emacs, this issue has become more relevant. I think as a start we can implement a There are some guidelines on how to do this at https://git.savannah.gnu.org/cgit/emacs.git/tree/admin/notes/tree-sitter/starter-guide |
Is it viable to contribute |
If you want to put up with GNU and the FSF to get your code into Emacs, feel free to. I, however, won't take part in that. (I think there are also less political arguments against having go-ts-mode in Emacs, such as mismatching release cycles between Go and Emacs.) |
Based on the document To1ne linked to, it seems like we should implement a new major mode I will probably work on this myself in the near future. |
FYI Emacs has worked on a go-ts-mode, https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-29&id=fee2efe1b035d601ac53a32801227402e9be8bca |
That's great! With that I consider this issue closed. One thing would be nice though, if it would be possible to use (defun gofmt-before-save ()
"Add this to .emacs to run gofmt on the current buffer when saving:
\(add-hook 'before-save-hook 'gofmt-before-save).
Note that this will cause ‘go-mode’ to get loaded the first time
you save any file, kind of defeating the point of autoloading."
(interactive)
- (when (eq major-mode 'go-mode) (gofmt)))
+ (when (member major-mode '(go-mode go-ts-mode)) (gofmt))) Until that, I have this in my config: (defun my-go-mode-setup ()
"Setup Go mode to my liking."
(add-hook 'before-save-hook 'gofmt nil t))
(use-package go-mode
:ensure t
:mode (("\\.go$" . go-ts-mode))
:hook ((go-mode go-ts-mode) . my-go-mode-setup)
:custom (gofmt-command "goimports")) Or you could use this if you like: https://gist.github.com/GnaneshKunal/3d3f982ce1903990eedd586952893422 |
I don't. Using that mode loses you most of the features of the current go-mode, and doesn't use tree-sitter to its full potential to replace most of the custom navigation functions in go-mode, like go-goto-arguments. Big fan of the fact they took the name go-ts-mode, too, while not owning go-mode. |
Closing in favour of #428. |
We can replace most, if not all, of our custom movement functions with tree-sitter, making them more robust.
The text was updated successfully, but these errors were encountered: