GNU bug report logs -
#75650
30.0.93; Unexpected indentation of members of inner classes in java-ts-mode
Previous Next
Full log
Message #8 received at 75650 <at> debbugs.gnu.org (full text, mbox):
Hennes Märtins <hennes <at> maertins-zone.de> writes:
> Create a new java-ts-mode buffer with the following content:
>
> class Foo
> {
> class Bar
> {
> int baz;
> }
> }
>
> Indent the whole buffer (C-x h <tab>) and it becomes:
>
> class Foo
> {
> class Bar
> {
> int baz;
> }
> }
>
> The indentation level for baz becomes three, but I would expect it to be
> two. A level of two is used in java-mode too.
>
> If I put the opening curly brace to the end of the previous line, the
> indentation level becomes two as expected:
>
> class Foo {
> class Bar {
> int baz;
> }
> }
>
> I found a personal workaround for this by modifying the variable
> java-ts-mode--indent-rules. I replace the entry:
>
> ((parent-is "class_body") column-0 c-ts-common-statement-offset)
>
> with:
>
> ((parent-is "class_body") parent-bol java-ts-mode-indent-offset)
>
> That works for me, but I am not sure if that is the correct solution.
>
> I can reproduce this also in:
> GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.33, cairo version 1.16.0) of 2025-01-18
Theodor, any comments here?
> In GNU Emacs 30.0.93 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
> version 1.16.0) of 2024-12-27 built on starlight
> Repository revision: 186ea407326166ee4669ce6fe84871c1e16c657c
> Repository branch: emacs-30
> Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
> System Description: Ubuntu 22.04.5 LTS
This bug report was last modified 119 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.