GNU bug report logs - #77803
tsx-ts-mode: wrong indentation for variables declarations

Previous Next

Package: emacs;

Reported by: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>

Date: Mon, 14 Apr 2025 15:43:01 UTC

Severity: normal

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


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

From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
To: bug-gnu-emacs <at> gnu.org
Subject: tsx-ts-mode: wrong indentation for variables declarations
Date: Mon, 14 Apr 2025 18:41:42 +0300
Given this TypeScript snippet:

    const a = 1,
          b = 2;
    var c = 3,
        d = 4;

…both b and d are expected to be indented to `typescript-ts-mode-indent-offset`
(2 by default). This both makes logical sense and is the behavior in another
editor VSCode.

Instead it gets indented to the length of `const` and `var` + space.

I'd note a separate problem: if you have this code:


    const a = 1,
      b = 2,
          c = 3;

…and you try to indent `c`, instead of getting indented to the previous line it
keeps being at "const + space" length.




This bug report was last modified 73 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.