emacs-devel
[Top][All Lists]
Advanced

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

Re: treesit indentation "blinking"


From: Dmitry Gutov
Subject: Re: treesit indentation "blinking"
Date: Thu, 30 Mar 2023 19:29:44 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0

On 30/03/2023 13:00, João Távora wrote:
On Thu, Mar 30, 2023 at 10:36 AM Dmitry Gutov <dgutov@yandex.ru> wrote:

On 30/03/2023 12:28, João Távora wrote:
This problematic already counts as "bouncing" to me, for some meaning of
"bouncing". c++-mode doesn't behave like that because indentation is
already where it is supposed to be if you type that sequence of
keystrokes.

Okay, if that's what you meant.

I think this one (indentation after RET in an incomplete function
definition) should be fixed in the indentation rules. The contents of
electric-indent-chars won't fix it either way.

This is all down to indentation rules, that's how electric-indent-mode
decides what to do.  My point is that having electric-indent-chars be
this ambitious with "broken" indentation rules isn't a good place to
be.

In this instance, removing chars off electric-indent-chars won't conceal the problem: the user can still type RET or press TAB and see unexpected indentation where Emacs should have been able to guess the correct one.

What counts as "broken" indentation is also arguable though. When dealing
with invalid programs, there is really no "right" or "wrong" indentation.
See my message https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62412#14 where
I show cases where c++-ts-mode's answer to indenting an invalid program
makes more sense than c++-mode's answer.

It's not cut-and-dried indeed, but historically, with the "native" major modes we, wittingly or not, have used the principle that code fully typed until point is considered "decidable", even if some missing code after point makes the it incomplete. Even though, on rare occasions, continuing to type might change the indentation again (e.g. for "case labels", if the indent style dedents them).

Whatever the indentation rules, the current bouncing is so jarring
that it really doesn't encourage people to try switching to
c++-ts-mode, get used to its set of indentation rules, and then perhaps
experience its other benefits like, say, performance or simplicity.

At least it didn't for me.  I'm back to c++-mode atm.

In my opinion electric-indent-char should be reduced to the default
and should be added criteriously as the indentation rules they trigger
are fixed.

We should probably revisit this after an honest attempt to fix these two cases.



reply via email to

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