Subject: Re: bug#68054: [PATCH] Add tree-sitter indent rule for lexical decls in js/typescript

From: Dmitry Gutov <[email-masked]>
Date: Thu, 25 Apr 2024 02:15:16 +0300

On 24/04/2024 05:36, Noah Peart wrote:
>  > What js-mode does (looks like 3) shouldn't be too bad, but I wouldn't
> mind an extra indentation level for such cases, too (example 2).
> 
> The problem I found with option 2/3 was cases like the following (which
> also seem like the most common) where I expect the start of
> the function be indented according to `typescript-ts-mode-indent-offset`,
> not with the declaration keyword "const" as in `js-mode` (and option 3).
> 
>      const someFuncWithReallyLongName =
>        async (x: number, y: number, z: number): Promise<void> => {
>          // ...
>        };

I don't know, in my understanding the line break after the "=" (or its 
absence) is usually a good enough look to choose between indentation 
offsets for a given statement. I.e. with the break after = it would be 
indented deeply, and without it (keeping "async" on the first line) the 
body would have the same base indentation as the "const" statement.

Though of course some users like it differently anyway.