[Top][All Lists]

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

Re: treesit indentation "blinking"

From: Herman , Géza
Subject: Re: treesit indentation "blinking"
Date: Thu, 30 Mar 2023 17:03:18 +0200
User-agent: mu4e 1.10.0; emacs 30.0.50

Eli Zaretskii <eliz@gnu.org> writes:

>> [ examples snipped ]
>> Can you reproduce these? These happen both with emacs-29 and
>> several-day-old master with the latest tree-sitter-cpp (but it also
>> happens with a ~1 month-old tree-sitter-cpp).
> Thanks for the examples, but how are they related to the issue at
> hand?  We are discussing the possibly adverse effects that
> electric-indent-mode and the customization of electric-indent-chars by
> c-ts-base-mode might have on user experience while typing C/C++ code.

These are related because the root cause of the bouncing issue is that
tree sitter calculates the wrong intentation during the code is being
written (i.e., not complete).  If this were fixed, most of the bouncing
issue would go away.  Not everything, of course.  If a case causes
bouncing with c++-mode, then it will likely bounce with c++-ts-mode as

I wrote this in a previous email:

"In my opinion, this issue has two different parts:

1.  design problem which cannot be really solved.  Like this "std::"
thing.  The editor cannot read the programmer's mind (whether they will
put a second colon or not).  And because c++-mode behaves the same, I
don't really think this is a bug.  Or at least it is just a small one.

2.  tree-sitter related problem, where tree-sitter has the wrong idea of
the correct indentation of a line.  c++-ts-mode fails for one of the
most simple thing: write "int foo() {" into an empty c++-ts-mode buffer,
and press RET.  You'll notice that the cursor won't be indented.  Also,
TAB doesn't work either.  You need to manually press multiple spaces to
have indentation.  c++-mode doesn't have this problem.  Note, I
understand that calling this "ts has the wrong idea of correct
indentation" may be unfair, but for a user the correct indentation is
pretty clear in this situation.  In my opinion this is a bug (that's why
I reported #62412)."

> Are you saying that removing the customization of
> electric-indent-chars by c-ts-base-mode solves the problems you
> mention?  If not, then I think your examples should go into a separate
> bug report, which should be investigated separately.

No, the root cause doesn't have any relation to electric-indent-chars.


reply via email to

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