GNU bug report logs -
#62302
30.0.50; c/c++ tree sitter forward-sexp problem
Previous Next
Reported by: "Herman, Geza" <geza.herman <at> gmail.com>
Date: Mon, 20 Mar 2023 20:41:02 UTC
Severity: normal
Found in version 30.0.50
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #16 received at 62302-done <at> debbugs.gnu.org (full text, mbox):
Yuan Fu <casouri <at> gmail.com> writes:
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> Date: Mon, 20 Mar 2023 21:40:26 +0100
>>> From: "Herman, Geza" <geza.herman <at> gmail.com>
>>>
>>> With tree sitter, forward-sexp behaves a little strange. To reproduce:
>>> - copy the little example program below into a c++-ts-mode buffer
>>> - move the point to the opening curly brace of "main() {"
>>> - M-x forward-sexp
>>>
>>> This will move the point to the space character in "int a;". But without
>>> tree sitter, this moves the point to the closing brace of main (I
>>> believe this is the correct behavior).
>>>
>>> I noticed this problem because hideshow behaves strangely with tree sitter:
>>> - enable hideshow mode (M-x hs-minor-mode)
>>> - move the point to the same opening brace
>>> - M-x hs-toggle-hiding
>>>
>>> Hideshow should hide the whole body of main, but instead it only hides
>>> parts of the body, and the buffer ends up like this:
>>>
>>> int main() {... a;
>>> }
>>> int b;
>>> }
>>>
>>> If I set forward-sexp-function to nil, the problem goes away. I think
>>> this issue is somewhat related to #60894
>>>
>>> Here's the little example program:
>>>
>>> int main() {
>>> if (false) {
>>> int a;
>>> }
>>> int b;
>>> }
>>
>> Theo, Yuan: any comments? Can you look into fixing this?
>>
>> Thanks.
>
> Missed this, sorry :-)
>
> I modified the definition of "sexp" in c/c++-ts-mode. I think new
> definition is intuitive but only time will tell. The new definition
> works on the little example in this report.
>
> Yuan
It seems like this has been fixed, so I'm closing this bug report.
This bug report was last modified 1 year and 254 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.