Comments (8)
That's great! With that I consider this issue closed.
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.
from go-mode.el.
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 go-ts-mode
(similar to other -ts-mode
s). I'd love to have a look at it, when I find some time.
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
from go-mode.el.
FYI
Emacs has worked on a go-ts-mode, https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-29&id=fee2efe1b035d601ac53a32801227402e9be8bca
from go-mode.el.
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 gofmt-before-save
with go-ts-mode
. The change would be something along the lines of:
(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
from go-mode.el.
Is it viable to contribute go-ts-mode
to emacs itself? With eglot
already part of emacs, emacs will be able to provide modern Go environment out of the box, provided gopls
is available.
from go-mode.el.
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.)
from go-mode.el.
Based on the document To1ne linked to, it seems like we should implement a new major mode go-ts-mode
. Code that can be shared between the current go-mode
and the new go-ts-mode
will go in a base mode go-base-mode
.
I will probably work on this myself in the near future.
from go-mode.el.
Closing in favour of #428.
from go-mode.el.
Related Issues (20)
- The future of syntax highlighting HOT 6
- Please tag a new stable release if the master branch is in a good state HOT 2
- gofmt: Invalid rcs patch or internal error in go--apply-rcs-patch HOT 3
- Support golangci-lint for formatting HOT 1
- Emacs 29 (earlier too?) shows warning when entering go-mode HOT 2
- How to enable go test HOT 1
- When using go-mode eglot failes to properly connect with gopls HOT 3
- Delve HOT 1
- yaml templates using text/template and sprig
- redefine stock Emacs Compile to use go-build
- Support snake case in `subword-mode`
- support sentence(forward-sentence, backwork-sentence)
- Rewrite using tree-sitter HOT 4
- Test failure in test/go-indentation-test.el HOT 1
- `_` is treated as word syntax rather than symbol syntax HOT 1
- Can't override "g d" from godef-jump HOT 2
- add go-* shortcuts for various hard-to-find eglot operations HOT 2
- `go guru` is deprecated/removed from `x/tools` HOT 2
- `godef` for Go 1.22 HOT 1
- go-mode vs. go-ts-mode (included with Emacs) HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-mode.el.