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


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
Subject: bug#77803: closed (Re: bug#77803: [PATCH v2] Don't indent
 variable names to their declarator expression (bug#77803))
Date: Fri, 18 Apr 2025 23:44:04 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#77803: tsx-ts-mode: wrong indentation for variables declarations

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 77803 <at> debbugs.gnu.org.

-- 
77803: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=77803
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Yuan Fu <casouri <at> gmail.com>
To: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
Cc: Eli Zaretskii <eliz <at> gnu.org>, theo <at> thornhill.no, 77803-done <at> debbugs.gnu.org
Subject: Re: bug#77803: [PATCH v2] Don't indent variable names to their
 declarator expression (bug#77803)
Date: Fri, 18 Apr 2025 16:43:17 -0700
[Message part 3 (text/plain, inline)]

> On Apr 15, 2025, at 10:09 PM, Konstantin Kharlamov <Hi-Angel <at> yandex.ru> wrote:
> 
> On Tue, 2025-04-15 at 17:53 +0300, Konstantin Kharlamov wrote:
>> On Tue, 2025-04-15 at 17:42 +0300, Eli Zaretskii wrote:
>>> 
>>> Try
>>>       make -C test lisp/progmodes/typescript-ts-mode-tests
>> 
>> Thank you, please see the patch!
> 
> v2: no code change, just noticed a typo in patch description, a "one
> space" instead of "two spaces" after the dot, and a missing dot in the
> final sentence: fixed.
[1.patch (text/x-patch, attachment)]
[Message part 5 (text/plain, inline)]
Thanks! I personally like the current indentation, but indeed other editors, and more importantly prettier, indents like what your patch implemented. I applied the patch to emacs-30 and pushed.

Yuan
[Message part 6 (message/rfc822, inline)]
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.