From: Eli Zaretskii <eliz@gnu.org>
To: Theodor Thornhill <theo@thornhill.no>
Cc: bruce.stephens@isode.com, casouri@gmail.com, 59686@debbugs.gnu.org
Subject: bug#59686: 30.0.50; tree-sitter indentation in some loops and conditional statements is wrong
Date: Fri, 02 Dec 2022 10:39:21 +0200 [thread overview]
Message-ID: <83v8mufbd2.fsf@gnu.org> (raw)
In-Reply-To: <A0CA40DB-15DA-4E01-8B68-98C923A9AE10@thornhill.no> (bug-gnu-emacs@gnu.org)
> Cc: 59686@debbugs.gnu.org
> Date: Fri, 02 Dec 2022 06:42:03 +0100
> From: Theodor Thornhill via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
>
> >> // -*- c-ts -*-
> >> int main() {
> >> for (int i=0; i<10; ++i) {
> >> foo(i);
> >> }
> >>
> >> for (int i=0;
> >> i<10;
> >> ++i) {
> >> foo(i);
> >> }
> >> }
> >
> >I see, that’s because the indent rule finds the BOL of the line where
> >the "{" is on, and indents from there. Theo, WDYT? Does indent style
> >fix this, or we should change the indent rules?
> >
> >Yuan
>
> I've seen this issue myself, and have tried several combinations to fix it. It is trivial to fix this particular case, but because compound_statement is used everywhere problems will pop up other places. The fix here would be some grand-parent-bol function, but if my memory serves that would mess up the else in an if else. I'm happy to see this fixed, but just remember that it's not _super_ trivial.
>
> Other languages exhibit similar issues, but with other constructs.
FWIW, this is an unusual style, so I see no catastrophe if it is not 110%
according to expectations. Users can easily fix that by tweaking their BOLs
where important.
next prev parent reply other threads:[~2022-12-02 8:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-29 18:41 bug#59686: 30.0.50; tree-sitter indentation in some loops and conditional statements is wrong Bruce Stephens
2022-12-02 5:13 ` Yuan Fu
2022-12-02 5:42 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-02 8:39 ` Eli Zaretskii [this message]
2022-12-02 9:20 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-02 10:46 ` Bruce Stephens
2022-12-02 11:51 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-03 10:48 ` Yuan Fu
2022-12-03 11:08 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-12-03 11:19 ` Yuan Fu
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83v8mufbd2.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=59686@debbugs.gnu.org \
--cc=bruce.stephens@isode.com \
--cc=casouri@gmail.com \
--cc=theo@thornhill.no \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).