GNU bug report logs -
#76704
30.1; Indentation of braces on separate line in js-ts-mode
Previous Next
Reported by: Fabian Brosda <f.brosda <at> gmx.de>
Date: Mon, 3 Mar 2025 04:33:03 UTC
Severity: minor
Found in version 30.1
Done: Eli Zaretskii <eliz <at> gnu.org>
Bug is archived. No further changes may be made.
Full log
Message #37 received at 76704 <at> debbugs.gnu.org (full text, mbox):
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
This bug report was last modified 90 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.