Subject: bug#60044: 30.0.50; hideshow in python-ts-mode not working

From: Yuan Fu <[email-masked]>
Date: Sat, 7 Jan 2023 15:15:47 -0800

Yuan Fu <[email-masked]> writes:

> Daniel Kraus <[email-masked]> writes:
>
>> Not sure if this is a bug report or feature request
>> but I use hideshow for code folding and I see that
>> `python-base-mode` only adds python-mode to hs-special-modes-alist:
>>
>>   (add-to-list
>>    'hs-special-modes-alist
>>    `(python-mode
>>      ,python-nav-beginning-of-block-regexp
>>      ;; Use the empty string as end regexp so it doesn't default to
>>      ;; "\\s)".  This way parens at end of defun are properly hidden.
>>      ""
>>      "#"
>>      python-hideshow-forward-sexp-function
>>      nil
>>      python-nav-beginning-of-block
>>      python-hideshow-find-next-block
>>      python-info-looking-at-beginning-of-block))
>>
>>
>> Simply adding the same with python-ts-mode makes hideshow work
>> but I guess maybe `python-nav-beginning-of-block` etc should
>> be replaced with the equivalent tree-sitter functions?!
>> Maybe it's the same with the other treesit modes, I haven't checked.
>>
>> Thanks,
>>   Daniel
>
> Thanks for reporting this! For now I just python-ts-mode to the setup,
> as you suggested. In the future we will switch it to use tree-sitter.
>
> Yuan

Supporting hideshow with tree-sitter is harder that I thought. I didn’t
make it work. So "in the future" is now "in the distant future" :-)

Yuan