GNU bug report logs - #68054
[PATCH] Add tree-sitter indent rule for lexical decls in js/typescript

Previous Next

Package: emacs;

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


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

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Noah Peart <noah.v.peart <at> gmail.com>
Cc: Yuan Fu <casouri <at> gmail.com>, 68054 <at> debbugs.gnu.org
Subject: Re: bug#68054: [PATCH] Add tree-sitter indent rule for lexical decls
 in js/typescript
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.




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.