GNU bug report logs -
#61142
29.0.60; java-ts-mode - Wrong indentation for the body of multiple lines conditions
Previous Next
Reported by: 太阳 <zjyzhaojiyang <at> hotmail.com>
Date: Sun, 29 Jan 2023 08:33:03 UTC
Severity: normal
Found in version 29.0.60
Fixed in version 29.1
Done: Theodor Thornhill <theo <at> thornhill.no>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Theodor Thornhill <theo <at> thornhill.no> writes:
> Eli Zaretskii <eliz <at> gnu.org> writes:
>
>>> Cc: "61142 <at> debbugs.gnu.org" <61142 <at> debbugs.gnu.org>
>>> Date: Sun, 05 Feb 2023 20:19:19 +0100
>>> From: Theodor Thornhill via "Bug reports for GNU Emacs,
>>> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>>
>>> +(defvar c-ts-common-nestable-if-statement-p t
>>> + "Does the current parser nest if-else statements?
>>> +
>>> +T if the current tree-sitter grammar nests the else if
>>> +statements, NIL otherwise.")
>>
>> A nit: we use t and nil, lowercase, to refer to these two symbols.
>>
>> Thanks.
>
> Thanks!
>
> Theo
I added some small tweaks, and will add the following as a test later:
```
public class Java {
public Java(
String foo) {
this.foo = foo;
}
void foo(
String foo) {
for (var f : rs)
return new String[]{
"foo",
"bar"
};
if (a == 0
&& b == 1
&& foo) {
return 0;
} else if (a == 1) {
return 1;
} else if (true)
return 5;
else {
if (a == 0
&& b == 1
&& foo)
while (true)
for (
;;)
if (true)
return 5;
else if (false) {
return 6;
} else
if (true
&& false)
return 6;
}
}
}
```
Even though its some pretty wild code, its indented correctly after this
patch. I'll create something similar for C as well.
Theo
[0001-Use-c-ts-common-statement-offset-in-java-ts-mode-bug.patch (text/x-patch, attachment)]
This bug report was last modified 2 years and 112 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.