GNU bug report logs -
#77803
tsx-ts-mode: wrong indentation for variables declarations
Previous Next
To reply to this bug, email your comments to 77803 AT debbugs.gnu.org.
There is no need to reopen the bug first.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Mon, 14 Apr 2025 15:43:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Mon, 14 Apr 2025 15:43:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
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.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Tue, 15 Apr 2025 09:03:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 77803 <at> debbugs.gnu.org (full text, mbox):
> From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> 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.
Thanks.
Theo and Yuan, any suggestions or comments?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Tue, 15 Apr 2025 13:36:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 77803 <at> debbugs.gnu.org (full text, mbox):
On Tue, 2025-04-15 at 12:02 +0300, Eli Zaretskii wrote:
> > From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> > 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.
>
> Thanks.
>
> Theo and Yuan, any suggestions or comments?
I dug into it a big — I think, the solution should be adding this line
((parent-is "variable_declarator") parent-bol typescript-ts-mode-indent-offset)
to the list inside `typescript-ts-mode--indent-rules`.
However, when I evaluate the defun and try re-indenting, nothing
changes, it still gets indented to `const `.
I see that evaluating `(treesit-node-parent (treesit-node-at (point)))`
results in "#<treesit-node variable_declarator in 623-688>", so
presumably the fix should work. I'd appreciate a hint on how to see
what rule gets actually triggered during indentation, that results in
the change not doing anything.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Tue, 15 Apr 2025 14:34:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 77803 <at> debbugs.gnu.org (full text, mbox):
On Tue, 2025-04-15 at 16:35 +0300, Konstantin Kharlamov wrote:
> On Tue, 2025-04-15 at 12:02 +0300, Eli Zaretskii wrote:
> > > From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> > > 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.
> >
> > Thanks.
> >
> > Theo and Yuan, any suggestions or comments?
>
> I dug into it a big — I think, the solution should be adding this
> line
>
> ((parent-is "variable_declarator") parent-bol typescript-ts-
> mode-indent-offset)
>
> to the list inside `typescript-ts-mode--indent-rules`.
>
> However, when I evaluate the defun and try re-indenting, nothing
> changes, it still gets indented to `const `.
>
> I see that evaluating `(treesit-node-parent (treesit-node-at
> (point)))`
> results in "#<treesit-node variable_declarator in 623-688>", so
> presumably the fix should work. I'd appreciate a hint on how to see
> what rule gets actually triggered during indentation, that results in
> the change not doing anything.
Okay, I figured it all out, going to send patch, but another thing I
stumbled upon: are tests not working? I mean, the `test/README` says I
could run "make <filename> -or- make <filename>.log".
But:
╰─λ make typescript-ts-mode-tests
make: *** No rule to make target 'typescript-ts-mode-tests'. Stop.
╰─λ make typescript-ts-mode-tests.el
make: *** No rule to make target 'typescript-ts-mode-tests.el'. Stop.
╰─λ make test/lisp/progmodes/typescript-ts-mode-tests.el
make: 'test/lisp/progmodes/typescript-ts-mode-tests.el' is up to date.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Tue, 15 Apr 2025 14:44:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 77803 <at> debbugs.gnu.org (full text, mbox):
> From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> Cc: 77803 <at> debbugs.gnu.org
> Date: Tue, 15 Apr 2025 17:33:21 +0300
>
> Okay, I figured it all out, going to send patch, but another thing I
> stumbled upon: are tests not working? I mean, the `test/README` says I
> could run "make <filename> -or- make <filename>.log".
>
> But:
>
> ╰─λ make typescript-ts-mode-tests
> make: *** No rule to make target 'typescript-ts-mode-tests'. Stop.
> ╰─λ make typescript-ts-mode-tests.el
> make: *** No rule to make target 'typescript-ts-mode-tests.el'. Stop.
> ╰─λ make test/lisp/progmodes/typescript-ts-mode-tests.el
> make: 'test/lisp/progmodes/typescript-ts-mode-tests.el' is up to date.
Try
make -C test lisp/progmodes/typescript-ts-mode-tests
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Tue, 15 Apr 2025 14:54:01 GMT)
Full text and
rfc822 format available.
Message #20 received at 77803 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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!
[1.patch (text/x-patch, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Wed, 16 Apr 2025 05:10:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 77803 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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)]
Reply sent
to
Yuan Fu <casouri <at> gmail.com>
:
You have taken responsibility.
(Fri, 18 Apr 2025 23:44:04 GMT)
Full text and
rfc822 format available.
Notification sent
to
Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
:
bug acknowledged by developer.
(Fri, 18 Apr 2025 23:44:04 GMT)
Full text and
rfc822 format available.
Message #28 received at 77803-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (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 3 (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
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Sat, 19 Apr 2025 01:03:02 GMT)
Full text and
rfc822 format available.
Message #31 received at 77803 <at> debbugs.gnu.org (full text, mbox):
On 19/04/2025 02:43, Yuan Fu wrote:
> Thanks! I personally like the current indentation,
js2-mode has been doing it this way for a number of years (triggered by
user requests), js-mode followed suit later.
So it's hard to call the current indentation incorrect. Could use a user
option. Maybe take js2-pretty-multiline-declarations as an example.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Sat, 19 Apr 2025 05:47:01 GMT)
Full text and
rfc822 format available.
Message #34 received at 77803 <at> debbugs.gnu.org (full text, mbox):
On Sat, 2025-04-19 at 04:02 +0300, Dmitry Gutov wrote:
> On 19/04/2025 02:43, Yuan Fu wrote:
> > Thanks! I personally like the current indentation,
>
> js2-mode has been doing it this way for a number of years (triggered
> by
> user requests), js-mode followed suit later.
That's unusual, do you have a link to the discussion? Such indentation
doesn't make sense to me (because when you have "const" and "var"
declarations near, they won't be aligned); and when I test it in VSCode
which I think most Web devs are using, it indents both to 3 spaces.
> So it's hard to call the current indentation incorrect. Could use a
> user
> option. Maybe take js2-pretty-multiline-declarations as an example.
Interesting point btw, is there docs how to customize tree-sitter
indentation? I looked around and found this post¹, however it's
specific to c-ts-mode, because it relies on `c-ts-mode-indent-style`
function.
1:
https://emacs.stackexchange.com/questions/77232/c-c-with-tree-sitter-how-to-change-indent
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Sat, 19 Apr 2025 07:23:02 GMT)
Full text and
rfc822 format available.
Message #37 received at 77803 <at> debbugs.gnu.org (full text, mbox):
> From: Yuan Fu <casouri <at> gmail.com>
> Date: Fri, 18 Apr 2025 16:43:17 -0700
> Cc: Eli Zaretskii <eliz <at> gnu.org>,
> theo <at> thornhill.no,
> 77803-done <at> debbugs.gnu.org
>
> 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.
Thank you.
Konstantin, please in the future remember NOT to change the subject of
the messages you send to the bug tracker, since if you do, that makes
it a tad harder to find related messages when reviewing the whole
discussion, finding messages that didn't get response, etc.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Sat, 19 Apr 2025 07:33:06 GMT)
Full text and
rfc822 format available.
Message #40 received at 77803 <at> debbugs.gnu.org (full text, mbox):
> Date: Sat, 19 Apr 2025 04:02:11 +0300
> From: Dmitry Gutov <dmitry <at> gutov.dev>
>
> On 19/04/2025 02:43, Yuan Fu wrote:
> > Thanks! I personally like the current indentation,
>
> js2-mode has been doing it this way for a number of years (triggered by
> user requests), js-mode followed suit later.
>
> So it's hard to call the current indentation incorrect. Could use a user
> option. Maybe take js2-pretty-multiline-declarations as an example.
Yes, if more than 2 indentation styles could be favored, a user-level
indentation-style option is in order.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Sat, 19 Apr 2025 07:33:08 GMT)
Full text and
rfc822 format available.
Message #43 received at 77803 <at> debbugs.gnu.org (full text, mbox):
On Sat, 2025-04-19 at 10:22 +0300, Eli Zaretskii wrote:
> > From: Yuan Fu <casouri <at> gmail.com>
> > Date: Fri, 18 Apr 2025 16:43:17 -0700
> > Cc: Eli Zaretskii <eliz <at> gnu.org>,
> > theo <at> thornhill.no,
> > 77803-done <at> debbugs.gnu.org
> >
> > 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.
>
> Thank you.
>
> Konstantin, please in the future remember NOT to change the subject
> of
> the messages you send to the bug tracker, since if you do, that makes
> it a tad harder to find related messages when reviewing the whole
> discussion, finding messages that didn't get response, etc.
Okay. Sorry, I used to see on mailing lists that people change the
subject when discussion somewhat diverges; and I also see that
bugtracker has no functional to show latest patch revision. So when
there's like 5 versions of patches somewhere in the discussion, I
imagined it may be difficult to maintainers to see which one is latest,
so I tried to work around that problem by appending the "PATCH" and the
version field. Sorry if this doesn't help.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Sat, 19 Apr 2025 07:46:01 GMT)
Full text and
rfc822 format available.
Message #46 received at 77803 <at> debbugs.gnu.org (full text, mbox):
> From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> Date: Sat, 19 Apr 2025 08:46:11 +0300
>
> > So it's hard to call the current indentation incorrect. Could use a
> > user
> > option. Maybe take js2-pretty-multiline-declarations as an example.
>
> Interesting point btw, is there docs how to customize tree-sitter
> indentation? I looked around and found this post¹, however it's
> specific to c-ts-mode, because it relies on `c-ts-mode-indent-style`
> function.
C/C++ indentation styles are indeed specific to c-ts-mode, but nothing
prevents us from having a similar command in other modes. Not every
major mode wants to support several indentation styles, so I'm not
sure a global treesit-level facility is justified.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Sat, 19 Apr 2025 08:31:02 GMT)
Full text and
rfc822 format available.
Message #49 received at 77803 <at> debbugs.gnu.org (full text, mbox):
> From: Konstantin Kharlamov <Hi-Angel <at> yandex.ru>
> Cc: theo <at> thornhill.no, 77803 <at> debbugs.gnu.org
> Date: Sat, 19 Apr 2025 10:32:36 +0300
>
> On Sat, 2025-04-19 at 10:22 +0300, Eli Zaretskii wrote: >
> Konstantin, please in the future remember NOT to change the subject
> > of > the messages you send to the bug tracker, since if you do,
> that makes > it a tad harder to find related messages when reviewing
> the whole > discussion, finding messages that didn't get response,
> etc.
>
> Okay. Sorry, I used to see on mailing lists that people change the
> subject when discussion somewhat diverges; and I also see that
> bugtracker has no functional to show latest patch revision. So when
> there's like 5 versions of patches somewhere in the discussion, I
> imagined it may be difficult to maintainers to see which one is latest,
> so I tried to work around that problem by appending the "PATCH" and the
> version field. Sorry if this doesn't help.
You can include the version in the body of the message. And even if
you don't, we can manage.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Sat, 19 Apr 2025 13:32:04 GMT)
Full text and
rfc822 format available.
Message #52 received at 77803 <at> debbugs.gnu.org (full text, mbox):
On 19/04/2025 08:46, Konstantin Kharlamov wrote:
> On Sat, 2025-04-19 at 04:02 +0300, Dmitry Gutov wrote:
>> On 19/04/2025 02:43, Yuan Fu wrote:
>>> Thanks! I personally like the current indentation,
>> js2-mode has been doing it this way for a number of years (triggered
>> by
>> user requests), js-mode followed suit later.
> That's unusual, do you have a link to the discussion? Such indentation
> doesn't make sense to me (because when you have "const" and "var"
> declarations near, they won't be aligned); and when I test it in VSCode
> which I think most Web devs are using, it indents both to 3 spaces.
https://github.com/mooz/js2-mode/issues/1 is when it was added, then see
other reports in the tracker about refining it and adding support for
different cases.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Sat, 19 Apr 2025 23:00:04 GMT)
Full text and
rfc822 format available.
Message #55 received at 77803 <at> debbugs.gnu.org (full text, mbox):
On Sat, 2025-04-19 at 16:31 +0300, Dmitry Gutov wrote:
> On 19/04/2025 08:46, Konstantin Kharlamov wrote:
> > On Sat, 2025-04-19 at 04:02 +0300, Dmitry Gutov wrote:
> > > On 19/04/2025 02:43, Yuan Fu wrote:
> > > > Thanks! I personally like the current indentation,
> > > js2-mode has been doing it this way for a number of years
> > > (triggered
> > > by
> > > user requests), js-mode followed suit later.
> > That's unusual, do you have a link to the discussion? Such
> > indentation
> > doesn't make sense to me (because when you have "const" and "var"
> > declarations near, they won't be aligned); and when I test it in
> > VSCode
> > which I think most Web devs are using, it indents both to 3 spaces.
>
> https://github.com/mooz/js2-mode/issues/1 is when it was added, then
> see
> other reports in the tracker about refining it and adding support for
> different cases.
Oooh… it seems to be a misunderstanding. The user wasn't asking to
indent every declaration to the declarator (as it was in ts-tsx-mode
and as it seems now in jsx-mode). The user pointed out the indentation
wasn't working at all, and showed "expected indentation", where there
are 4 spaces used; however it is an accident that 4 spaces are equal to
"var" + space.
If you test VSCode with JS file, you'll see it too indents them to 4
spaces, i.e. "var" + space… However, if you replace `var` with `const`,
VSCode will still use same indentation, it won't try to indent to
"`const` + space". Which makes sense.
I see that it is easy to misinterpret the OP's example as an ask to
indent variables to the declarator, unfortunately I don't think that
was something the issue author was asking for.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Sun, 20 Apr 2025 00:39:04 GMT)
Full text and
rfc822 format available.
Message #58 received at 77803 <at> debbugs.gnu.org (full text, mbox):
On 20/04/2025 01:58, Konstantin Kharlamov wrote:
>> https://github.com/mooz/js2-mode/issues/1 is when it was added, then
>> see
>> other reports in the tracker about refining it and adding support for
>> different cases.
>
> Oooh… it seems to be a misunderstanding. The user wasn't asking to
> indent every declaration to the declarator (as it was in ts-tsx-mode
> and as it seems now in jsx-mode). The user pointed out the indentation
> wasn't working at all, and showed "expected indentation", where there
> are 4 spaces used; however it is an accident that 4 spaces are equal to
> "var" + space.
There were no protests from the user, and as I said, you can search the
tracker for other requests for refining this indentation method.
Or see https://debbugs.gnu.org/8576, for when this feature was added to
js-mode.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Sun, 20 Apr 2025 04:38:01 GMT)
Full text and
rfc822 format available.
Message #61 received at 77803 <at> debbugs.gnu.org (full text, mbox):
> On Apr 19, 2025, at 5:38 PM, Dmitry Gutov <dmitry <at> gutov.dev> wrote:
>
> On 20/04/2025 01:58, Konstantin Kharlamov wrote:
>
>>> https://github.com/mooz/js2-mode/issues/1 is when it was added, then
>>> see
>>> other reports in the tracker about refining it and adding support for
>>> different cases.
>> Oooh… it seems to be a misunderstanding. The user wasn't asking to
>> indent every declaration to the declarator (as it was in ts-tsx-mode
>> and as it seems now in jsx-mode). The user pointed out the indentation
>> wasn't working at all, and showed "expected indentation", where there
>> are 4 spaces used; however it is an accident that 4 spaces are equal to
>> "var" + space.
>
> There were no protests from the user, and as I said, you can search the tracker for other requests for refining this indentation method.
>
> Or see https://debbugs.gnu.org/8576, for when this feature was added to js-mode.
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?
Yuan
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Sun, 20 Apr 2025 05:24:02 GMT)
Full text and
rfc822 format available.
Message #64 received at 77803 <at> debbugs.gnu.org (full text, mbox):
On Sun, 2025-04-20 at 03:38 +0300, Dmitry Gutov wrote:
> On 20/04/2025 01:58, Konstantin Kharlamov wrote:
>
> > > https://github.com/mooz/js2-mode/issues/1 is when it was added,
> > > then
> > > see
> > > other reports in the tracker about refining it and adding support
> > > for
> > > different cases.
> >
> > Oooh… it seems to be a misunderstanding. The user wasn't asking to
> > indent every declaration to the declarator (as it was in ts-tsx-
> > mode
> > and as it seems now in jsx-mode). The user pointed out the
> > indentation
> > wasn't working at all, and showed "expected indentation", where
> > there
> > are 4 spaces used; however it is an accident that 4 spaces are
> > equal to
> > "var" + space.
>
> There were no protests from the user, and as I said, you can search
> the
> tracker for other requests for refining this indentation method.
>
> Or see https://debbugs.gnu.org/8576, for when this feature was added
> to
> js-mode.
I suspect there weren't protests because the declaration style may not
be frequently used among web devs. Add to that that most people never
bother reporting bugs for the problem they encounter; and then
additionally that web-devs specifically from my personal experience
frequently don't know/understand much beyond just web-devel
(particularly, the understanding that open-source project problem is
something you can report or maybe even fix — that frequently lacks even
among usual devs, but in web-devel field it's like multiplied) — I
think there's high chance the reason wrong "const" indentation wasn't
reported, is just because no one bothered.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Sun, 20 Apr 2025 05:35:02 GMT)
Full text and
rfc822 format available.
Message #67 received at 77803 <at> debbugs.gnu.org (full text, mbox):
On Sun, 2025-04-20 at 08:23 +0300, Konstantin Kharlamov wrote:
> On Sun, 2025-04-20 at 03:38 +0300, Dmitry Gutov wrote:
> > On 20/04/2025 01:58, Konstantin Kharlamov wrote:
> >
> > > > https://github.com/mooz/js2-mode/issues/1 is when it was added,
> > > > then
> > > > see
> > > > other reports in the tracker about refining it and adding
> > > > support
> > > > for
> > > > different cases.
> > >
> > > Oooh… it seems to be a misunderstanding. The user wasn't asking
> > > to
> > > indent every declaration to the declarator (as it was in ts-tsx-
> > > mode
> > > and as it seems now in jsx-mode). The user pointed out the
> > > indentation
> > > wasn't working at all, and showed "expected indentation", where
> > > there
> > > are 4 spaces used; however it is an accident that 4 spaces are
> > > equal to
> > > "var" + space.
> >
> > There were no protests from the user, and as I said, you can search
> > the
> > tracker for other requests for refining this indentation method.
> >
> > Or see https://debbugs.gnu.org/8576, for when this feature was
> > added
> > to
> > js-mode.
>
> I suspect there weren't protests because the declaration style may
> not
> be frequently used among web devs. Add to that that most people never
> bother reporting bugs for the problem they encounter; and then
> additionally that web-devs specifically from my personal experience
> frequently don't know/understand much beyond just web-devel
> (particularly, the understanding that open-source project problem is
> something you can report or maybe even fix — that frequently lacks
> even
> among usual devs, but in web-devel field it's like multiplied) — I
> think there's high chance the reason wrong "const" indentation wasn't
> reported, is just because no one bothered.
Sorry, forgot to add: I pinged both participants on the linked issue,
let's see what they say. I suspect though the OP may not reply, he had
no Github activity since 2023, and it was always scarce.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#77803
; Package
emacs
.
(Mon, 21 Apr 2025 22:44:01 GMT)
Full text and
rfc822 format available.
Message #70 received at 77803 <at> debbugs.gnu.org (full text, mbox):
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?
This bug report was last modified 2 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.