bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#62302: 30.0.50; c/c++ tree sitter forward-sexp problem


From: Stefan Kangas
Subject: bug#62302: 30.0.50; c/c++ tree sitter forward-sexp problem
Date: Tue, 5 Sep 2023 16:50:10 -0700

Yuan Fu <casouri@gmail.com> writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>>> Date: Mon, 20 Mar 2023 21:40:26 +0100
>>> From: "Herman, Geza" <geza.herman@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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]