go-mode.el icon indicating copy to clipboard operation
go-mode.el copied to clipboard

Rewrite using tree-sitter

Open dominikh opened this issue 1 year ago • 4 comments

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.

dominikh avatar Oct 20 '23 20:10 dominikh

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?

fedeizzo avatar Mar 08 '24 08:03 fedeizzo

@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.

dominikh avatar Mar 08 '24 12:03 dominikh

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

emad-elsaid avatar May 18 '24 15:05 emad-elsaid

Thank you for the offer, but no.

dominikh avatar May 18 '24 17:05 dominikh