[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode
From: |
Vincenzo Pupillo |
Subject: |
bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode |
Date: |
Tue, 01 Apr 2025 23:04:14 +0200 |
Ciao Fabian,
this updated patch fix all yours example and others corner case of arrow
function, chained member expression.
For switch body indentation now possible to use js-switch-indent-offset as in
js-mode. js-chain-indent can be used to achieve the same behavior as js-mode
for that chained member expression.
Can you please try it again?
Vincenzo
In data venerdì 28 marzo 2025 11:53:49 Ora legale dell’Europa centrale, Fabian
Brosda ha scritto:
> Hi Vincenzo,
>
> >> great that there is already an updated patch. I did test it and it looks
> >> good for functions, conditionals, loops. Regarding arrow functions (or
> >> variable declarations in general), the result is different, then with
> >> js-mode, but personally I think the result looks more consistent in
> >> js-ts-mode.
> >
> > Could you please show me this difference?
>
> The examples are not really complex, just a few maybe a bit unusual
> cases I could think of. You can find the gist containing the js-mode
> and js-ts-mode (including your latest patch) version and a diff here:
>
> https://gist.github.com/fbrosda/11870561bb009be87b719d5b9a7aa625
>
> A short summary:
>
> - Declaring a variable and assigning an arrow function, the braces are
> not indented in js-ts-mode, but indented to the start of the variable
> in js-mode (also compare the difference between let and const)
> - Similar cases, when having a line break in a variable declaration.
> js-ts-mode uses the fixed indentation js-indent-level, while js-mode
> indents to the start of the variable name. Observe the difference
> between const and let. I personally prefer the js-ts-mode, so that
> const and let, if you mix the two. But at least in my code, this is
> normally used very rarely, so both versions are fine.
> - switch-cases have a few differences. For switch with the { on a
> separate line, it is imo wrong in js-mode to indent the case
> statements, as the blocks inside the case are not further indented.
> Switches inside a function break in js-ts-mode, as they have a nega
>
>
> Hope this helps.
>
> Fabian
0001-Fix-indentation-of-when-on-a-new-line-of-a-function-.patch
Description: Text Data
- bug#76704: 30.1; Indentation of braces on separate line in js-ts-mode,
Vincenzo Pupillo <=