Subject: Re: bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter

From: Herman, Géza <[email-masked]>
Date: Sun, 26 Mar 2023 15:54:09 +0200

On 3/25/23 12:43, João Távora wrote:
> Let's assume you turn off electric-indent-mode. In c++-mode, pressing RET
> after:
>
>     int main() {
>
> "correctly" indents the next line.  In c++-ts-mode, it doesn't.
>
> Both programs are ill-formed but you're right that after correcting
> that, by say adding 'return 0; RET }', the c++-mode version of the
> same program is closer to being correctly indented.
I'd say that the current c++-ts-mode behavior is very bad for this example.

If you type this into an empty buffer:

int main() {

and press RET, the new line won't get indented. But the case is worse, 
because TAB doesn't work either (doesn't do anything). Supposedly 
because tree sitter has the wrong idea of the indentation: if add 
indentation by using spaces, pressing TAB deletes the spaces.

(Note: it doesn't matter whether electric-indent-mode is turned on or 
off, same thing happens).