GNU bug report logs - #59686
30.0.50; tree-sitter indentation in some loops and conditional statements is wrong

Previous Next

Package: emacs;

Reported by: Bruce Stephens <bruce.stephens <at> isode.com>

Date: Tue, 29 Nov 2022 18:42:01 UTC

Severity: normal

Merged with 60398, 60496

Found in versions 29.0.60, 30.0.50

Full log


Message #8 received at 59686 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: bruce.stephens <at> isode.com
Cc: Theodor Thornhill <theo <at> thornhill.no>, 59686 <at> debbugs.gnu.org
Subject: Re: bug#59686: 30.0.50; tree-sitter indentation in some loops and 
 conditional statements is wrong
Date: Thu, 1 Dec 2022 21:13:42 -0800
Bruce Stephens <bruce.stephens <at> isode.com> writes:

> With the following file I would expect foo(i) to be indented to just two
> indents (like the first one), but they are not. Similarly for many other
> compound statements where the opening spans more than one line.
>
> // -*- 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




This bug report was last modified 2 years and 207 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.