dominikh / go-mode.el

Emacs mode for the Go programming language
BSD 3-Clause "New" or "Revised" License
1.37k stars 209 forks source link

Rewrite using tree-sitter #428

Open dominikh opened 8 months ago

dominikh commented 8 months ago

I have started on a tree-sitter-based rewrite of go-mode. The plan going forward is to tag a final release of the existing go-mode, then replace it with the tree-sitter-based one and require Emacs 29 + tree-sitter for all future versions.

The tree-sitter version, aside from being much simpler, will also fix various bugs involving indentation and navigation, especially involving generics. Syntax highlighting will likely get a fair bit more powerful, too.

I have decided against maintaining both the old and new version as separate modes. Using a proper (and fast) parser is the way forward. The current implementation of syntax highlighting, indentation and navigation is based on a hacky collection of regular expressions. The code is barely maintainable, doesn't handle several corner-cases correctly, and we haven't managed to update it to support generics reliably for years. We clearly don't have the manpower or interest to keep working on the existing code base. Instead of keeping an unmaintained copy of the old version around, make it very clear that we will only work on the tree-sitter version going forward.

This also means that the tree-sitter-based mode will not be getting its own name; it will continue to be called go-mode. There will be two tree-sitter-based modes: our go-mode, and the buggy, low-effort go-ts-mode that comes bundled with Emacs.

fedeizzo commented 3 months ago

Hey @dominikh 👋 thank you for the amazing work. Any news on the rewrite? I don't see any public branch on tag, are you working on that? If not, are you open to contributions?

dominikh commented 3 months ago

@fedeizzo I am working on it, yes. In part I am waiting on the next release of Emacs, as the current one has some unfortunate bugs.

emad-elsaid commented 1 month ago

is there a way we can help? if you have some plan to rewrite the parts and it could be done independently maybe we can help

dominikh commented 1 month ago

Thank you for the offer, but no.