emacs-devel
[Top][All Lists]
Advanced

[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 00:37:48 +0200
User-agent: mu4e 1.10.0; emacs 30.0.50

João Távora <joaotavora@gmail.com> writes:

> And then my personal opinion is that it is an annoying
> feature to have on by default as it whole lines about.
> Having electric-indent-chars set to '(?\n), like c++-mode
> has, is fine.
While c++-mode has only ?\n in electric-indent-chars, it does electric
indentation by other means. For example, ":" is bound to c-electric-colon,
which behaves the same as you described c++-ts-mode previously: the
"std" keeps dancing around as you put one and then two colons after it.

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).

Géza



reply via email to

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