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: Yuan Fu <casouri <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 77803 <at> debbugs.gnu.org, Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
Subject: bug#77803: [PATCH v2] Don't indent variable names to their declarator expression (bug#77803)
Date: Fri, 25 Apr 2025 17:44:55 -0700

> On Apr 21, 2025, at 3:43 PM, Dmitry Gutov <dmitry <at> gutov.dev> wrote:
> 
> On 20/04/2025 07:36, Yuan Fu wrote:
>> I can add a custom option that toggle this. We don’t need indentation styles for js, C/C++ is probably the only language that has that many established indentation styles. What would be a good name for the option? This custom option will be used for both js-ts-mode and jsx-ts-mode. js-ts-indent-align-multi-assignment-p?
> 
> Back when js2-mode used its own indentation code, we called it js2-pretty-multiline-declarations, and it wasn't just a boolean (one possible symbol value too):
> 
> https://github.com/mooz/js2-mode/blob/master/js2-old-indent.el#L75C12-L115
> 
> I don't have a strong opinion on the name, but just in case we'll want to support a third way maybe don't call it with '-p' at the end.
> 
> Also, it might be good to have the variable affect js-mode as well (and so it wouldn't need -ts- in the name) - it's just an extra check around the (js--multi-line-declaration-indentation) call inside js--proper-indentation.
> 
> Are there other js-mode indentation vars that affect js-ts-mode?

Ok, so the original path in this repot only changes typescript/tsx-ts-mode, and js-mode doesn’t align multivar declarations. So I only added an option to typescript-ts-mode that allows user to choose from the two indent style. The non-indent style seems to be the mainstream style (for better or worse), so I left the non-indent style as the default.

The original path is applied to emacs-30 and the new custom option is added to master.

Yuan



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.