GNU bug report logs -
#68054
[PATCH] Add tree-sitter indent rule for lexical decls in js/typescript
Previous Next
Reported by: Noah Peart <noah.v.peart <at> gmail.com>
Date: Wed, 27 Dec 2023 06:22:01 UTC
Severity: wishlist
Tags: patch
Done: Stefan Kangas <stefankangas <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
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 <dmitry <at> gutov.dev> 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.
>
[Message part 2 (text/html, inline)]
This bug report was last modified 191 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.