emacs-devel
[Top][All Lists]
Advanced

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

Re: treesit indentation "blinking"


From: João Távora
Subject: Re: treesit indentation "blinking"
Date: Sat, 25 Mar 2023 09:05:26 +0000

On Thu, Mar 23, 2023 at 9:24 PM Dmitry Gutov <dgutov@yandex.ru> wrote:
>
> On 23/03/2023 23:10, Daniel Colascione wrote:
> > Editing can cause all sorts of transient nonsense in the AST, and it's
> > impossible to predict in a general manner what this nonsense might be.
> > The wrong kind of bracket can cause the entire rest of the file to be
> > parsed as nonsense. This or that error recovery rule isn't going to
> > solve the problem: such a strategy is a fragile whack a mole. There
> > needs to be some general solution to prevent indentation blinking. This
> > blinking makes TS modules unusable for me.
>
> It seems to me it will only be feasible to support a number of
> "incomplete" syntax constructs. Maybe it will constitute a majority of them.

I don't think this problem has anything to do with tree-sitter.  It
would happen just as well in regular c++-mode if electric-indent-mode
were on by default there (but it isn't).

So it's just the fact that electric-indent-mode is on by default
_and_ c-ts-mode.el does this:

(setq-local electric-indent-chars (append "{}():;,#" electric-indent-chars))

so people are getting what the mode author (and Emacs defaults) ask for:
electric indentation doing its thing.

> Have you tried using electric-pair-mode, though? I'd hate to make it our
> strong recommendation for all ts modes, but it does reduce the odds of
> incomplete code a lot.

Maybe you'd hate it, but it would at least be consistent with the
setting for electric-indent-mode, which is much more jarring.

See also bug#62412 which is basically the same problem with a recipe.

João



reply via email to

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