all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: Theodor Thornhill <theo@thornhill.no>
Cc: 61142@debbugs.gnu.org, zjyzhaojiyang@hotmail.com
Subject: bug#61142: 29.0.60; java-ts-mode - Wrong indentation for the body of multiple lines conditions
Date: Sun, 05 Feb 2023 12:59:43 +0200	[thread overview]
Message-ID: <83bkm8s7hc.fsf@gnu.org> (raw)
In-Reply-To: <A587F41C-8965-4209-A7D1-C1E2D43B6874@thornhill.no> (message from Theodor Thornhill on Sun, 05 Feb 2023 11:25:52 +0100)

> Date: Sun, 05 Feb 2023 11:25:52 +0100
> From: Theodor Thornhill <theo@thornhill.no>
> CC: zjyzhaojiyang@hotmail.com, 61142@debbugs.gnu.org
> 
> There are some indentation issues where if you have 
> 
> void foo(
>   String foo) {
>   // ...
> }
> 
> Then the normal code will indent like
> 
> void foo(
>   String foo) {
>     //...
> }
> 
> Because of the parent-bol anchor. When these paired brackets are nested (and some other cases) we have to find the grand-parent, but that caused some other issues with ie c-ts-mode where compound_statements can be nested _and_ siblings. Yuan made an effort to make this work in c-ts-mode due to the many bug reports. He then generalized it into c-ts-common, for use in other modes, like java.
> 
> This patch adds support for that in java.
> 
> 
> >And one comment to the patch:
> >
> >> @@ -300,6 +302,20 @@ java-ts-mode
> >>    (c-ts-common-comment-setup)
> >>  
> >>    ;; Indent.
> >> +  (setq-local c-ts-common-indent-block-type-regexp
> >> +              (rx (or "class_body"
> >> +                      "\\`array_initializer"
> >> +                      "annotation_type_body"
> >> +                      "interface_body"
> >> +                      "interface_constructor_body"
> >> +                      "enum_body"
> >> +                      "switch_block"
> >> +                      "record_declaration_body"
> >> +                      "block")))
> >> +  (setq-local c-ts-common-indent-bracketless-type-regexp
> >> +              (rx (or "if_statement" "do_statement"
> >> +                      "for_statement" "while_statement")))
> >> +  (setq-local c-ts-common-indent-offset 'java-ts-mode-indent-offset)
> >>    (setq-local treesit-simple-indent-rules java-ts-mode--indent-rules)
> >>  
> >>    ;; Electric
> >
> >Why are we adding a c-ts-common-SOMETHING variable to java-ts-mode.el?
> >Shouldn't it be named java-ts-SOMETHING instead?  Or am I missing
> >something?
> 
> This is because there is some setup involved in the new bracket-counting code in c-ts-common.

OK, please install on emacs-29, and thanks.





  reply	other threads:[~2023-02-05 10:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <handler.61142.B.16749811447164.ack@debbugs.gnu.org>
2023-02-01  8:46 ` bug#61142: Acknowledgement (29.0.60; java-ts-mode - Wrong indentation for the body of multiple lines conditions) 太阳
2023-02-04 10:45   ` bug#61142: 29.0.60; java-ts-mode - Wrong indentation for the body of multiple lines conditions Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-05  7:53     ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-05  7:54       ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-05  9:20       ` Eli Zaretskii
2023-02-05  9:28         ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-05 10:15           ` Eli Zaretskii
2023-02-05 10:25             ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-05 10:59               ` Eli Zaretskii [this message]
2023-02-05 13:09       ` bug#61142: 回复: " 赵 纪阳
2023-02-05 19:19         ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-05 19:30           ` Eli Zaretskii
2023-02-05 19:32             ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-05 20:12               ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-05 21:20                 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-02-06  2:34                   ` bug#61142: 回复: " 赵 纪阳
2023-02-06  6:45                     ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-01-29  4:00 太阳

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=83bkm8s7hc.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=61142@debbugs.gnu.org \
    --cc=theo@thornhill.no \
    --cc=zjyzhaojiyang@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.