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)]
Sorry, I forgot about this. I've just added a rule to align the
variable_declarators
in let, var, and const declarations, but I need some feedback about the
indentation
for values in the variable_declarators following dangling '='.
For example, which of the following would be preferable?
1) indent the dangling values with respect to start of the declaration
const a =
(x: string): string => {
return x + x;
},
bbb =
{
"x": 0
},
cccc =
1,
ddddd = 0;
2) indent them with respect to the start of the variable_declarator
const a =
(x: string): string => {
return x + x;
},
bbb =
{
"x": 0
},
cccc =
1,
ddddd = 0;
3) align with the variable declarators (this is the same as js-mode)
const a =
(x: string): string => {
return x + x;
},
bbb =
{
"x": 0
},
cccc =
1,
ddddd = 0;
I've attached a patch with with the rules for the 3 options here.
On Sun, Dec 31, 2023 at 8:56 PM Yuan Fu <casouri <at> gmail.com> wrote:
>
>
> > On Dec 31, 2023, at 5:41 AM, Dmitry Gutov <dmitry <at> gutov.dev> wrote:
> >
> > On 31/12/2023 07:35, Noah Peart wrote:
> >> Yea, I agree that would be better - would you align on start the
> variable names, or '=' like
> >> `c-lineup-assignments`?
> >
> > Like js-mode would be good.
> >
> > I'm not familiar with c-lineup-assignments, but we could add different
> variations later.
>
> Also, if you are feeling adventurous, I noticed that the second variable
> in a lexical_declaration isn’t fontified in variable-name-face. It’d be
> nice to fix that as well.
>
> Yuan
[Message part 2 (text/html, inline)]
[typescript-ts-decl-indent.patch (text/x-patch, attachment)]
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.