[Top][All Lists]

[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: Tue, 4 Apr 2023 01:10:49 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0

On 04/04/2023 00:59, Daniel Colascione wrote:
On April 3, 2023 08:07:17 Dmitry Gutov <dgutov@yandex.ru> wrote:

On 03/04/2023 12:59, Alan Mackenzie wrote:
Hello, Dmitry.

On Mon, Apr 03, 2023 at 00:21:18 +0300, Dmitry Gutov wrote:
On 02/04/2023 20:23, João Távora wrote:
So my initial idea was to tone down electric-indent-chars, at least
for the moment.  And Dmitry's idea was to make electric-indent-chars
be ambitious_only_  if electric-pair-mode is enabled (by the user).
Maybe we should bring back that idea, and it seems the least bad of the
bunch right now.

Alternatively, we only perform "electric indent" (aside from after RET)
when the parse tree does not contain errors.

That is NOT electric indentation.  The whole point about electric
indentation is for it to take effect whilst point is still on the line
being edited.  Thus, for example, you can see whether or not the line
needs breaking, or whether there's room for a short comment at the end
of the line.

Wouldn't you know whether the line needs breaking, as long as the line
was indented correctly when you opened it with RET?

What you're proposing is something which would almost never trigger,
since a line being edited will not have a parse tree without errors (if
I've understood that properly).  If it did trigger at some point, that
would likely cause annoyance and puzzlement.

That's a fair assessment, but it's going to trigger in a lot of cases
still: after ;, or after a paren or brace being closed.

Silly question: can't we make a mode with c++-mode's indentation (and folding etc.) and c++-ts-mode's fontification? Such a thing would also preserve compatibility with the numerous ad hoc c++-mode styles out there.

Sure, we could: inherit from c++-mode and add then add most of c++-ts-mode's definition, just without indent-related variables. python-ts-mode is an example of such mode.

Whatever performance complaints people had about c++-mode, though, those will stay around, and perhaps get a little bit worse due to additional work of maintaining the tree-sitter parse tree.

And at least some of CC Mode's latest bug reports related to problems "parsing" the code (in the way that CC Mode does that). Such problems would be harder to spot when using the new hybrid mode because they won't affect syntax highlighting, but they could still affect indentation.

reply via email to

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