PA: Treesitter grammar for Cabal

A little over a year ago I hacked together a treesitter grammar for Cabal as I didn’t find one. It seems to be good enough (I’m using it daily in my Emacs config), but I’m sure it could be improved in many ways.

Hopefully it’s useful to others, and maybe it can even serve as a starting point to get an official grammar, or at least kickstart the creation of one.

7 Likes

It works really well, but the last time I tried it segfaults if the cabal file has merged conflict markers. I raised an issue about this but I can’t find it now - I think maybe you turned issues off on the repo?

@ocharles this appears to be the issue: Scanner crashes on files with merge conflicts (#2) · Issues · Magnus Therning / tree-sitter-cabal · GitLab

Great work! Do you want to open a PR against the cabal repo to add a link to your repo to the user manual? I’m not sure there’s already a great place fir this sort of thing but maybe we should have something like “Editor Support”…

Something like this?

It seems a little short, but maybe it’s enough to get started at least.

Sure! Upon a PR the devs will hopefully discuss it.