GNU bug report logs -
#75609
Hideshow support for treesitter
Previous Next
Reported by: Juri Linkov <juri <at> linkov.net>
Date: Thu, 16 Jan 2025 17:50:01 UTC
Severity: wishlist
Tags: patch
Fixed in version 31.0.50
Done: Juri Linkov <juri <at> linkov.net>
Bug is archived. No further changes may be made.
Full log
Message #11 received at 75609 <at> debbugs.gnu.org (full text, mbox):
>> +(defun treesit-hs-inside-comment-p ()
>> + (let ((thing (or (treesit-thing-at (point) "comment")
>> + (unless (bobp)
>> + (treesit-thing-at (1- (point)) "comment")))))
>> + (when thing
>> + (list (treesit-node-start thing) (treesit-node-end thing)))))
>> +
>
> FYI some grammar calls comments line_comment and block_comment.
> Maybe use the comment thing first, and then match “comment” with the node type?
We need to introduce the new thing named "comment".
It's necessary to add treesit support for 'forward-comment'
that is used in many packages including 'hideshow'.
This means adding the variable 'forward-comment-function'
with the default value 'forward-comment-default-function'.
Then will override it with 'treesit-forward-comment' that
uses the comment thing.
>> @@ -644,6 +648,9 @@ hs-inside-comment-p
>> beginning. If we are inside of a comment but this condition is not met,
>> we return a list having a nil as its car and the end of comment position
>> as cdr."
>> + (cond ((functionp hs-inside-comment-p-func)
>> + (funcall hs-inside-comment-p-func))
>> + (t
>
> Did you do this indentation on purpose to make a easier-to-read diff?
Indeed, this was to make it easier-to-read. And in the next patch
I will just rename the default function to 'hs-inside-comment-p--default'.
This bug report was last modified 115 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.