GNU bug report logs - #74386
Tree-sitter javascript indentation

Previous Next

Package: emacs;

Reported by: Marius Kjeldahl <marius.kjeldahl <at> gmail.com>

Date: Sat, 16 Nov 2024 23:28:02 UTC

Severity: normal

Full log


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

From: Yuan Fu <casouri <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 74386 <at> debbugs.gnu.org, Eli Zaretskii <eliz <at> gnu.org>,
 Theodor Thornhill <theo <at> thornhill.no>, marius.kjeldahl <at> gmail.com
Subject: Re: bug#74386: Tree-sitter javascript indentation
Date: Sun, 1 Dec 2024 11:10:14 -0800

> On Dec 1, 2024, at 5:11 AM, Dmitry Gutov <dmitry <at> gutov.dev> wrote:
> 
> On 01/12/2024 07:23, Yuan Fu wrote:
>>>> For more experimenting, also check out 'M-x treesit-explore-mode'.
>>>> 
>>>> And here's how to immediately find out which indentation rule was used:
>>>> 
>>>>   (setq treesit--indent-verbose t)
>>> Theo, please chime in.  Should Dmitry install his changes?
>> The standalone-parent anchor is designed specifically to solve the bug described here, and changing parent-bol to standalone-parent is very safe. So IMO we can merge this (either to emacs-30 or master).
> 
> Thanks for your answer.
> 
> What I was wondering, is whether we might need some user option(s) to switch back to parent-bol instead of standalone-parent for some constructs, and whether we should replace more uses of parent-bol with standaline-parent, and if so, which ones.
> 
> Also see the example of the indentation change with that patch (switching from one fairly popular indentation style to one slightly less popular - AFAIK).

Ah, I see. That’s a good point, and I definitely prefer the indentation result of parent-bol here. The one produced by standalone-parent is just wrong. What we can do is make standalone-parent ignore “.” when checking for “standaloneness”. And perhaps make it configurable so it’s enabled only for modes that this waiver makes sense (C-like languages excluding C and C++).

Yuan





This bug report was last modified 183 days ago.

Previous Next


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