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

From: Noah Peart <[email-masked]>
Date: Thu, 25 Apr 2024 15:48:37 -0700

Ok, I can make a patch for option 3 (the same as js-mode) instead. It's
implementation is the simplest also.  Would that work?

Thanks

On Wed, Apr 24, 2024 at 4:15 PM Dmitry Gutov <[email-masked]> wrote:

> 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.
>