GNU bug report logs - #75609
Hideshow support for treesitter

Previous Next

Package: emacs;

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


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 75609 <at> debbugs.gnu.org, casouri <at> gmail.com, monnier <at> iro.umontreal.ca
Subject: bug#75609: Hideshow support for treesitter
Date: Thu, 23 Jan 2025 20:56:01 +0200
>> > I'm curious: why do you have to use skip-syntax-forward/backward when
>> > tree-sitter already should know where a comment starts and ends?
>> > ideally, features that use tree-sitter should not need to consult any
>> > syntax tables set up by the major mode.  Or what am I missing?
>> 
>> tree-sitter has no information about whitespace, but whitespace is
>> essential part of the behavior according to the docstring of
>> 'forward-comment':
>> 
>>   Stop scanning if we find something other than a comment or whitespace.
>>   If COUNT comments are found as expected, with nothing except whitespace
>>   between them, return t; otherwise return nil.
>> 
>> So treesit should be able to skip whitespace as well:
>> 
>> default implementation = skip whitespace + check syntax table
>> treesit implementation = skip whitespace + check syntax tree
>
> I'm confused: are you saying that (skip-syntax-forward " >") skips
> whitespace?  AFAIU, it skips not just whitespace.  And to skip
> whitespace we don't need syntax-tables, do we?  I'm probably missing
> something.

Probably it would be fine to use just (skip-chars-forward " \t\n")
if I correctly understand the documentation of 'forward-comment'.




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.