GNU bug report logs -
#62412
29.0.60; strange c++ indentation behavior with tree sitter
Previous Next
Reported by: "Herman, Geza" <geza.herman <at> gmail.com>
Date: Thu, 23 Mar 2023 20:44:02 UTC
Severity: normal
Found in version 29.0.60
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
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).
This bug report was last modified 1 year and 331 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.