[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 12:26:16 +0200 |
User-agent: |
mu4e 1.10.0; emacs 30.0.50 |
Eli Zaretskii <eliz@gnu.org> writes:
> [...] Which is better indeed, but
> what c++-ts-mode does is not a catastrophe, either.
Maybe it's not a catastrophe, but it's far from behaving well.
Type this example into a c++-ts-mode buffer (I used "emacs -Q"):
--8<---------------cut here---------------start------------->8---
int main() {
for (;;) {
printf("Hello world\n");
}
}
--8<---------------cut here---------------end--------------->8---
This is how it will be indented as I wrote it here. c++-ts-mode doesn't
re-indent anything during typing, even though it had the chance to do
that, because electric-indent-mode is enabled by default, and
electric-indent-chars contains the necessary characters.
Or, another example. Put the "void foo() { }" part first into a
c++-ts-mode buffer, then write the main function:
--8<---------------cut here---------------start------------->8---
int main() {
int a = 0;
for (;;) {
printf("Hello!\n");
}
}
void foo() {
}
--8<---------------cut here---------------end--------------->8---
Again, c++-ts-mode doesn't indent anything.
If you change the example to contain "void foo();" instead of "void
foo() { }", then indenting happens during typing the main function.
If you try adding "int a = 0;" into the first example, then it will be
indented at typing the ";". But then for loop is still not get indented,
and the buffer will look like this:
--8<---------------cut here---------------start------------->8---
int main() {
int a = 0;
for (;;) {
printf("Hello world\n");
}
}
--8<---------------cut here---------------end--------------->8---
If you start by adding an empty comment, and then write the first
example above the empty comment, the buffer will look like this:
--8<---------------cut here---------------start------------->8---
int main() {
for (;;) {
printf("Hello world\n");
}
}
/**/
--8<---------------cut here---------------end--------------->8---
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).
Géza
- Re: treesit indentation "blinking", (continued)
- Re: treesit indentation "blinking", João Távora, 2023/03/30
- Re: treesit indentation "blinking", Dmitry Gutov, 2023/03/30
- Re: treesit indentation "blinking", João Távora, 2023/03/30
- Re: treesit indentation "blinking", Dmitry Gutov, 2023/03/30
- Re: treesit indentation "blinking", João Távora, 2023/03/30
- Re: treesit indentation "blinking", Eli Zaretskii, 2023/03/30
- Re: treesit indentation "blinking",
Herman , Géza <=
- Re: treesit indentation "blinking", Eli Zaretskii, 2023/03/30
- Re: treesit indentation "blinking", Herman , Géza, 2023/03/30
- Re: treesit indentation "blinking", Eli Zaretskii, 2023/03/30
- Re: treesit indentation "blinking", João Távora, 2023/03/30
- Re: treesit indentation "blinking", Eli Zaretskii, 2023/03/30
- Re: treesit indentation "blinking", João Távora, 2023/03/30
- Re: treesit indentation "blinking", Eli Zaretskii, 2023/03/30
- Re: treesit indentation "blinking", João Távora, 2023/03/30
- Re: treesit indentation "blinking", João Távora, 2023/03/25
- Re: treesit indentation "blinking", Eli Zaretskii, 2023/03/24