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 #8 received at 77901 <at> debbugs.gnu.org (full text, mbox):

From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
To: 77901 <at> debbugs.gnu.org
Subject: bug#77901: tsx-ts-mode: ternary chains are indented as a tree
Date: Thu, 01 May 2025 20:39:02 +0700
[Message part 1 (text/plain, inline)]
After poking around I wrote a patch (attached). Worth noting though, for
some reason it doesn't work for ternary without starting colon, e.g.:

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

I'm unclear why, per my understanding the "standalone-parent" of the
whole ternary chain (disregarding where the point is) is the `const a
=` declaration.

Such bug also persists in c++-ts-mode (as opposed to non-ts plain c++-
mode). I'm not sure if it's me misunderstanding something or not…
[1.patch (text/x-patch, attachment)]

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.