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

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

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


From: Herman
Subject: bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter
Date: Sun, 26 Mar 2023 15:54:09 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1



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).






reply via email to

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