GNU bug report logs - #77901
tsx-ts-mode: ternary chains are indented as a tree

Previous Next

Package: emacs;

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

Date: Fri, 18 Apr 2025 14:26:06 UTC

Severity: normal

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

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: ternary chains are indented as a tree
Date: Fri, 18 Apr 2025 17:06:34 +0300
Given this correctly indented code:

    const a = cond1 ? 1
      : cond2 ? 2
      : cond3 ? 3
      : 4;

if you reindent it, it turns into:

    const a = cond1 ? 1
      : cond2 ? 2
        : cond3 ? 3
          : 4;

Basically, for every colon it increases indentation. This is different
from other c-like languages (it's is indented as the first form
instead), and it's also different from Python. The "tree-indentation"
is not readable, so there's a reason other modes indent it as the
first example. Would it be possible to change in typescript mode as
well?




This bug report was last modified 11 days ago.

Previous Next


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