Is there a preferred way to handle this treesit wise. I know some packages (eg imenu) require major modes to define their support for it, but others like ispell do it themselves. I personally thing the latter would be better in this case.

On Thu, 5 Sept 2024 at 16:36, Juri Linkov <juri@linkov.net> wrote:
>>> Are there any plans to add treesitter support for hideshow, it seems easy
>>> enough to do and also very helpful, especially for langs that don't
>>> excessively use parens, such as python
>>
>> Indeed, it's easy to do this.  You just need to override
>> hs-find-block-beginning-func, hs-find-next-block-func, etc.
>> with treesit functions like 'treesit-outline-search'.
>
> Ah I see, then I think treesit.el should contain code for this, because
> this seems extremely useful task that would not make sense if each tree
> sitter based major mode was to implement this separately

Or hideshow code for treesit could be in hideshow.el as well.
The reason why 'treesit-outline-search' was added to treesit.el
was because treesit.el already contained imenu support.  But
imenu support could be in imenu.el as well.