rules_python icon indicating copy to clipboard operation
rules_python copied to clipboard

refactor: switch to official go tree-sitter implementation

Open jbedard opened this issue 7 months ago • 1 comments

The https://github.com/smacker/go-tree-sitter library seems dead and we should switch to the official https://github.com/tree-sitter/go-tree-sitter. I know there's already a lot of discussion around tree-sitter in rules_python/gazelle, I thought I should bring this into the discussion as well. This PR depends on even more patches then what https://github.com/dougthor42/go-tree-sitter is patching, I'm not sure how you want to deal with that going forward (I've found the latest rules_go solves 50% of it).

The official library has been properly maintained for some time now and has a lot of features that the smacker version is lacking. I was able to delete a decent amount of code in the js/ts gazelle extension when switching (such as all predicate filtering which is properly implemented in the official go-tree-sitter).

jbedard avatar Jun 02 '25 22:06 jbedard

FWIW I might be blocked on https://github.com/tree-sitter/go-tree-sitter/issues/32 for now so your plan upgrading rules_go and dropping the fork is probably still the next best step.

jbedard avatar Jun 03 '25 07:06 jbedard

Changing this to a draft until we have a larger discussion of this is worth it. I found https://github.com/tree-sitter/go-tree-sitter/issues/32 was too noticeable of a perf hit when changing the js gazelle extension.

jbedard avatar Jul 07 '25 17:07 jbedard

ACK, SGTM.

dougthor42 avatar Jul 07 '25 18:07 dougthor42