[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: |
Theodor Thornhill |
Subject: |
bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter |
Date: |
Sat, 25 Mar 2023 18:41:37 +0100 |
On 25 March 2023 17:23:35 CET, "João Távora" <joaotavora@gmail.com> wrote:
>"Herman, Géza" <geza.herman@gmail.com> writes:
>
>> On 3/25/23 12:43, João Távora wrote:
>>>
>>> There can be no "correct" indentation in a buffer with an invalid state.
>>>
>>> But there are heuristics. Here, it can be argued that c++-mode's
>>> heuristics are better.
>> I agree. In my opinion, c++-mode's heuristics are good.
>
>That's probably only because we're _used_ to c++-mode. If we had been
>using c++-ts-mode for years, we would be equally suprised.
>
>> Tree-sitter support is new, it's expected that it won't work
>> perfectly. Also, it doesn't have to handle any invalid program. But,
>> while writing a program, it should handle indentation sensibly. I
>> don't think that it's a good approach that everybody who uses electric
>> indent should get used to the fact that whenever they writing a for
>> loop, the line will jump around. It's a bad experience.
>
>But writing a for loop from scratch is only one of the editing
>activities you do in a C++ file. Other activities involve editing
>existing code. In those situations, c++-ts-mode's heuristics could
>"win". Unless you're willing to posit that writing code from scratch is
>more frequent than editing existing code, there's no right answer here.
>
>> Anyways, feel free to close this issue if you think otherwise. I just
>> disabled ';'-caused auto indenting, so I don't see this unpleasant
>> behavior any more.
>
>Yes, i'm inclined to think that c++-ts-mode shouldn't add any chars to
>electric-indent-chars. It's just not useful.
>
>João
I won't object to this, as I hold no strong opinions either way. Would removing
it cause less confusion, yet still reindent correctly in most cases?
If so, feel free to remove it, unless anyone else objects :)
Theo
- bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter, Herman, Geza, 2023/03/23
- bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter, Yuan Fu, 2023/03/24
- bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter, Theodor Thornhill, 2023/03/24
- bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter, Herman, 2023/03/25
- bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter, João Távora, 2023/03/25
- bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter, Herman, 2023/03/25
- bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter, João Távora, 2023/03/25
- bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter,
Theodor Thornhill <=
- bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter, Herman, 2023/03/25
- bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter, João Távora, 2023/03/25
- bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter, Herman, 2023/03/26
- bug#62412: 29.0.60; strange c++ indentation behavior with tree sitter, Daniel Martín, 2023/03/26