GNU bug report logs - #67031
[PATCH] Fix typescript-ts-mode indentation in unbracketed statements

Previous Next

Package: emacs;

Reported by: nvp <noah.v.peart <at> gmail.com>

Date: Fri, 10 Nov 2023 01:31:02 UTC

Severity: normal

Tags: patch

Fixed in version 29.2

Done: Dmitry Gutov <dmitry <at> gutov.dev>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 67031 in the body.
You can then email your comments to 67031 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Fri, 10 Nov 2023 01:31:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to nvp <noah.v.peart <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Fri, 10 Nov 2023 01:31:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: nvp <noah.v.peart <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Fix typescript-ts-mode indentation in unbracketed statements
Date: Thu, 9 Nov 2023 17:29:21 -0800
[Message part 1 (text/plain, inline)]
Tags: patch


* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--indent-rules): fix indentation after statements
without brackets

Bug: There are no indentation rules for statement bodies following
if/for/for_in/do/while statements without brackets.

Recipe to reproduce:
In a `typescript-ts-mode` buffer with the following code,

    if (true)
    console.log('No indent here')

Try to indent the second line.

In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
3.24.33, cairo version 1.16.0) of 2023-11-05 built on noah-X580VD
Repository revision: b819b8d6e90337b4cb36b35c2c6d0112c90a8e24
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101004
System Description: Ubuntu 22.04.3 LTS

Configured using:
 'configure --prefix=/usr/local --with-modules --with-tree-sitter
--with-threads --with-x-toolkit=gtk3 --with-xwidgets --with-gnutls
--with-json --with-mailutils --with-jpeg --with-png --with-rsvg
--with-tiff --with-xml2 --with-xpm --with-imagemagick CC=gcc-12
CXX=gcc-12'
[Message part 2 (text/html, inline)]
[typescript-ts-mode-indentation.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Wed, 15 Nov 2023 16:08:03 GMT) Full text and rfc822 format available.

Message #8 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: nvp <noah.v.peart <at> gmail.com>, Dmitry Gutov <dmitry <at> gutov.dev>,
 Yuan Fu <casouri <at> gmail.com>
Cc: 67031 <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Wed, 15 Nov 2023 15:40:48 +0200
> From: nvp <noah.v.peart <at> gmail.com>
> Date: Thu, 9 Nov 2023 17:29:21 -0800
> 
> Tags: patch
> 
> * lisp/progmodes/typescript-ts-mode.el
> (typescript-ts-mode--indent-rules): fix indentation after statements
> without brackets
> 
> Bug: There are no indentation rules for statement bodies following
> if/for/for_in/do/while statements without brackets.
> 
> Recipe to reproduce:
> In a `typescript-ts-mode` buffer with the following code, 
> 
>     if (true)
>     console.log('No indent here')
> 
> Try to indent the second line.

Dmitry, Yuan: any comments?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Thu, 16 Nov 2023 01:19:02 GMT) Full text and rfc822 format available.

Message #11 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Eli Zaretskii <eliz <at> gnu.org>, nvp <noah.v.peart <at> gmail.com>,
 Yuan Fu <casouri <at> gmail.com>
Cc: 67031 <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Thu, 16 Nov 2023 03:18:44 +0200
On 15/11/2023 15:40, Eli Zaretskii wrote:
>> From: nvp<noah.v.peart <at> gmail.com>
>> Date: Thu, 9 Nov 2023 17:29:21 -0800
>>
>> Tags: patch
>>
>> * lisp/progmodes/typescript-ts-mode.el
>> (typescript-ts-mode--indent-rules): fix indentation after statements
>> without brackets
>>
>> Bug: There are no indentation rules for statement bodies following
>> if/for/for_in/do/while statements without brackets.
>>
>> Recipe to reproduce:
>> In a `typescript-ts-mode` buffer with the following code,
>>
>>      if (true)
>>      console.log('No indent here')
>>
>> Try to indent the second line.
> Dmitry, Yuan: any comments?

I think it would be cool if the patch added a corresponding new case or 
two in test/lisp/progmodes/typescript-ts-mode-resources/indent.erts




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Sat, 18 Nov 2023 10:06:02 GMT) Full text and rfc822 format available.

Message #14 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: casouri <at> gmail.com, noah.v.peart <at> gmail.com, Dmitry Gutov <dmitry <at> gutov.dev>
Cc: 67031 <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Sat, 18 Nov 2023 12:05:43 +0200
> Date: Thu, 16 Nov 2023 03:18:44 +0200
> Cc: 67031 <at> debbugs.gnu.org
> From: Dmitry Gutov <dmitry <at> gutov.dev>
> 
> On 15/11/2023 15:40, Eli Zaretskii wrote:
> >> From: nvp<noah.v.peart <at> gmail.com>
> >> Date: Thu, 9 Nov 2023 17:29:21 -0800
> >>
> >> Tags: patch
> >>
> >> * lisp/progmodes/typescript-ts-mode.el
> >> (typescript-ts-mode--indent-rules): fix indentation after statements
> >> without brackets
> >>
> >> Bug: There are no indentation rules for statement bodies following
> >> if/for/for_in/do/while statements without brackets.
> >>
> >> Recipe to reproduce:
> >> In a `typescript-ts-mode` buffer with the following code,
> >>
> >>      if (true)
> >>      console.log('No indent here')
> >>
> >> Try to indent the second line.
> > Dmitry, Yuan: any comments?
> 
> I think it would be cool if the patch added a corresponding new case or 
> two in test/lisp/progmodes/typescript-ts-mode-resources/indent.erts

Noah, would you please add such tests?

Yuan, any comments or suggestions?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Sun, 19 Nov 2023 00:14:02 GMT) Full text and rfc822 format available.

Message #17 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Noah Peart <noah.v.peart <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, casouri <at> gmail.com, 67031 <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Sat, 18 Nov 2023 16:12:46 -0800
[Message part 1 (text/plain, inline)]
Yea, I can do that.

Is there a recipe for running the tests with a tree-sitter library path?

On Sat, Nov 18, 2023 at 2:05 AM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > Date: Thu, 16 Nov 2023 03:18:44 +0200
> > Cc: 67031 <at> debbugs.gnu.org
> > From: Dmitry Gutov <dmitry <at> gutov.dev>
> >
> > On 15/11/2023 15:40, Eli Zaretskii wrote:
> > >> From: nvp<noah.v.peart <at> gmail.com>
> > >> Date: Thu, 9 Nov 2023 17:29:21 -0800
> > >>
> > >> Tags: patch
> > >>
> > >> * lisp/progmodes/typescript-ts-mode.el
> > >> (typescript-ts-mode--indent-rules): fix indentation after statements
> > >> without brackets
> > >>
> > >> Bug: There are no indentation rules for statement bodies following
> > >> if/for/for_in/do/while statements without brackets.
> > >>
> > >> Recipe to reproduce:
> > >> In a `typescript-ts-mode` buffer with the following code,
> > >>
> > >>      if (true)
> > >>      console.log('No indent here')
> > >>
> > >> Try to indent the second line.
> > > Dmitry, Yuan: any comments?
> >
> > I think it would be cool if the patch added a corresponding new case or
> > two in test/lisp/progmodes/typescript-ts-mode-resources/indent.erts
>
> Noah, would you please add such tests?
>
> Yuan, any comments or suggestions?
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Sun, 19 Nov 2023 01:26:02 GMT) Full text and rfc822 format available.

Message #20 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Noah Peart <noah.v.peart <at> gmail.com>, Eli Zaretskii <eliz <at> gnu.org>
Cc: casouri <at> gmail.com, 67031 <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Sun, 19 Nov 2023 03:24:49 +0200
On 19/11/2023 02:12, Noah Peart wrote:
> Yea, I can do that.
> 
> Is there a recipe for running the tests with a tree-sitter library path?

You mean with the default tree-sitter librayr path overridden? I'm not sure.

But note that you can run an ert test in your interactive session, or 
alter treesit-extra-load-path temporarily at the beginning of the ert 
test file, at least while you debug it locally.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Sun, 19 Nov 2023 04:27:02 GMT) Full text and rfc822 format available.

Message #23 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: noah.v.peart <at> gmail.com, 67031 <at> debbugs.gnu.org,
 Dmitry Gutov <dmitry <at> gutov.dev>
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Sat, 18 Nov 2023 20:26:36 -0800

> On Nov 18, 2023, at 2:05 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
> 
>> Date: Thu, 16 Nov 2023 03:18:44 +0200
>> Cc: 67031 <at> debbugs.gnu.org
>> From: Dmitry Gutov <dmitry <at> gutov.dev>
>> 
>> On 15/11/2023 15:40, Eli Zaretskii wrote:
>>>> From: nvp<noah.v.peart <at> gmail.com>
>>>> Date: Thu, 9 Nov 2023 17:29:21 -0800
>>>> 
>>>> Tags: patch
>>>> 
>>>> * lisp/progmodes/typescript-ts-mode.el
>>>> (typescript-ts-mode--indent-rules): fix indentation after statements
>>>> without brackets
>>>> 
>>>> Bug: There are no indentation rules for statement bodies following
>>>> if/for/for_in/do/while statements without brackets.
>>>> 
>>>> Recipe to reproduce:
>>>> In a `typescript-ts-mode` buffer with the following code,
>>>> 
>>>>     if (true)
>>>>     console.log('No indent here')
>>>> 
>>>> Try to indent the second line.
>>> Dmitry, Yuan: any comments?
>> 
>> I think it would be cool if the patch added a corresponding new case or 
>> two in test/lisp/progmodes/typescript-ts-mode-resources/indent.erts
> 
> Noah, would you please add such tests?
> 
> Yuan, any comments or suggestions?

LGTM, I’ll also add else_clause too, like

((parent-is ,(rx (or (seq (or "if" "for" "for_in" "while" "do") "_statement")
                     "else_clause")))
 parent-bol typescript-ts-mode-indent-offset)

Yuan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Sun, 19 Nov 2023 06:09:02 GMT) Full text and rfc822 format available.

Message #26 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: noah.v.peart <at> gmail.com, casouri <at> gmail.com, 67031 <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Sun, 19 Nov 2023 08:08:19 +0200
> Date: Sun, 19 Nov 2023 03:24:49 +0200
> Cc: casouri <at> gmail.com, 67031 <at> debbugs.gnu.org
> From: Dmitry Gutov <dmitry <at> gutov.dev>
> 
> On 19/11/2023 02:12, Noah Peart wrote:
> > Yea, I can do that.
> > 
> > Is there a recipe for running the tests with a tree-sitter library path?
> 
> You mean with the default tree-sitter librayr path overridden? I'm not sure.

Why would an ERT test need that?  We are supposed to test Emacs with
the otherwise installed system features.  As tree-sitter grammars are
not part of Emacs, there should be no need to tell Emacs to use a
grammar library other than the one installed on the system.  Right?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Sun, 19 Nov 2023 07:20:02 GMT) Full text and rfc822 format available.

Message #29 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Noah Peart <noah.v.peart <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, casouri <at> gmail.com, 67031 <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Sat, 18 Nov 2023 23:19:24 -0800
[Message part 1 (text/plain, inline)]
I don't think the test runs when it doesn't find a typescript parser.  Ill
double check
tomorrow, but temporarily adding a treesit-extra load path should be ok.

Thanks

On Sat, Nov 18, 2023 at 10:08 PM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > Date: Sun, 19 Nov 2023 03:24:49 +0200
> > Cc: casouri <at> gmail.com, 67031 <at> debbugs.gnu.org
> > From: Dmitry Gutov <dmitry <at> gutov.dev>
> >
> > On 19/11/2023 02:12, Noah Peart wrote:
> > > Yea, I can do that.
> > >
> > > Is there a recipe for running the tests with a tree-sitter library
> path?
> >
> > You mean with the default tree-sitter librayr path overridden? I'm not
> sure.
>
> Why would an ERT test need that?  We are supposed to test Emacs with
> the otherwise installed system features.  As tree-sitter grammars are
> not part of Emacs, there should be no need to tell Emacs to use a
> grammar library other than the one installed on the system.  Right?
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Sun, 19 Nov 2023 13:39:02 GMT) Full text and rfc822 format available.

Message #32 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: noah.v.peart <at> gmail.com, casouri <at> gmail.com, 67031 <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Sun, 19 Nov 2023 15:38:44 +0200
On 19/11/2023 08:08, Eli Zaretskii wrote:
>> Date: Sun, 19 Nov 2023 03:24:49 +0200
>> Cc:casouri <at> gmail.com,67031 <at> debbugs.gnu.org
>> From: Dmitry Gutov<dmitry <at> gutov.dev>
>>
>> On 19/11/2023 02:12, Noah Peart wrote:
>>> Yea, I can do that.
>>>
>>> Is there a recipe for running the tests with a tree-sitter library path?
>> You mean with the default tree-sitter librayr path overridden? I'm not sure.
> Why would an ERT test need that?  We are supposed to test Emacs with
> the otherwise installed system features.  As tree-sitter grammars are
> not part of Emacs, there should be no need to tell Emacs to use a
> grammar library other than the one installed on the system.  Right?

We have a way to override that with the variable 
treesit-extra-load-path, so it follows that some users will take 
advantage of it to add extra directories.

I'm using ~/.emacs.d/tree-sitter/ myself.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Mon, 20 Nov 2023 12:56:02 GMT) Full text and rfc822 format available.

Message #35 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Noah Peart <noah.v.peart <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 67031 <at> debbugs.gnu.org, casouri <at> gmail.com
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Mon, 20 Nov 2023 04:55:26 -0800
[Message part 1 (text/plain, inline)]
Yea, I'm using the same.  But, would it be useful to have a way to set that
when
running tests without needing to temporarily add set
`treesit-extra-load-path` in
the test file?

On Sun, Nov 19, 2023 at 5:38 AM Dmitry Gutov <dmitry <at> gutov.dev> wrote:

> On 19/11/2023 08:08, Eli Zaretskii wrote:
> >> Date: Sun, 19 Nov 2023 03:24:49 +0200
> >> Cc:casouri <at> gmail.com,67031 <at> debbugs.gnu.org
> >> From: Dmitry Gutov<dmitry <at> gutov.dev>
> >>
> >> On 19/11/2023 02:12, Noah Peart wrote:
> >>> Yea, I can do that.
> >>>
> >>> Is there a recipe for running the tests with a tree-sitter library
> path?
> >> You mean with the default tree-sitter librayr path overridden? I'm not
> sure.
> > Why would an ERT test need that?  We are supposed to test Emacs with
> > the otherwise installed system features.  As tree-sitter grammars are
> > not part of Emacs, there should be no need to tell Emacs to use a
> > grammar library other than the one installed on the system.  Right?
>
> We have a way to override that with the variable
> treesit-extra-load-path, so it follows that some users will take
> advantage of it to add extra directories.
>
> I'm using ~/.emacs.d/tree-sitter/ myself.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Mon, 20 Nov 2023 18:09:01 GMT) Full text and rfc822 format available.

Message #38 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Noah Peart <noah.v.peart <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 67031 <at> debbugs.gnu.org, casouri <at> gmail.com
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Mon, 20 Nov 2023 10:07:43 -0800
[Message part 1 (text/plain, inline)]
Here is an updated patch with the added "else_clause" and indentation test
for
statements without braces.

On Mon, Nov 20, 2023 at 4:55 AM Noah Peart <noah.v.peart <at> gmail.com> wrote:

> Yea, I'm using the same.  But, would it be useful to have a way to set
> that when
> running tests without needing to temporarily add set
> `treesit-extra-load-path` in
> the test file?
>
> On Sun, Nov 19, 2023 at 5:38 AM Dmitry Gutov <dmitry <at> gutov.dev> wrote:
>
>> On 19/11/2023 08:08, Eli Zaretskii wrote:
>> >> Date: Sun, 19 Nov 2023 03:24:49 +0200
>> >> Cc:casouri <at> gmail.com,67031 <at> debbugs.gnu.org
>> >> From: Dmitry Gutov<dmitry <at> gutov.dev>
>> >>
>> >> On 19/11/2023 02:12, Noah Peart wrote:
>> >>> Yea, I can do that.
>> >>>
>> >>> Is there a recipe for running the tests with a tree-sitter library
>> path?
>> >> You mean with the default tree-sitter librayr path overridden? I'm not
>> sure.
>> > Why would an ERT test need that?  We are supposed to test Emacs with
>> > the otherwise installed system features.  As tree-sitter grammars are
>> > not part of Emacs, there should be no need to tell Emacs to use a
>> > grammar library other than the one installed on the system.  Right?
>>
>> We have a way to override that with the variable
>> treesit-extra-load-path, so it follows that some users will take
>> advantage of it to add extra directories.
>>
>> I'm using ~/.emacs.d/tree-sitter/ myself.
>>
>
[Message part 2 (text/html, inline)]
[typescript-ts-mode-indentation.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Mon, 20 Nov 2023 18:14:02 GMT) Full text and rfc822 format available.

Message #41 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Noah Peart <noah.v.peart <at> gmail.com>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 67031 <at> debbugs.gnu.org, casouri <at> gmail.com
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Mon, 20 Nov 2023 10:13:23 -0800
[Message part 1 (text/plain, inline)]
Sorry, ignore the previous patch.  A couple additional rules were needed to
handle
"while" and "else".

On Mon, Nov 20, 2023 at 10:07 AM Noah Peart <noah.v.peart <at> gmail.com> wrote:

> Here is an updated patch with the added "else_clause" and indentation test
> for
> statements without braces.
>
> On Mon, Nov 20, 2023 at 4:55 AM Noah Peart <noah.v.peart <at> gmail.com> wrote:
>
>> Yea, I'm using the same.  But, would it be useful to have a way to set
>> that when
>> running tests without needing to temporarily add set
>> `treesit-extra-load-path` in
>> the test file?
>>
>> On Sun, Nov 19, 2023 at 5:38 AM Dmitry Gutov <dmitry <at> gutov.dev> wrote:
>>
>>> On 19/11/2023 08:08, Eli Zaretskii wrote:
>>> >> Date: Sun, 19 Nov 2023 03:24:49 +0200
>>> >> Cc:casouri <at> gmail.com,67031 <at> debbugs.gnu.org
>>> >> From: Dmitry Gutov<dmitry <at> gutov.dev>
>>> >>
>>> >> On 19/11/2023 02:12, Noah Peart wrote:
>>> >>> Yea, I can do that.
>>> >>>
>>> >>> Is there a recipe for running the tests with a tree-sitter library
>>> path?
>>> >> You mean with the default tree-sitter librayr path overridden? I'm
>>> not sure.
>>> > Why would an ERT test need that?  We are supposed to test Emacs with
>>> > the otherwise installed system features.  As tree-sitter grammars are
>>> > not part of Emacs, there should be no need to tell Emacs to use a
>>> > grammar library other than the one installed on the system.  Right?
>>>
>>> We have a way to override that with the variable
>>> treesit-extra-load-path, so it follows that some users will take
>>> advantage of it to add extra directories.
>>>
>>> I'm using ~/.emacs.d/tree-sitter/ myself.
>>>
>>
[Message part 2 (text/html, inline)]
[typescript-ts-mode-indentation.patch (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Mon, 20 Nov 2023 22:29:02 GMT) Full text and rfc822 format available.

Message #44 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Noah Peart <noah.v.peart <at> gmail.com>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 67031 <at> debbugs.gnu.org, casouri <at> gmail.com
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Tue, 21 Nov 2023 00:28:23 +0200
On 20/11/2023 20:13, Noah Peart wrote:
> Sorry, ignore the previous patch.  A couple additional rules were needed 
> to handle
> "while" and "else".

Looking good.

Eli, should this go to emacs-29?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Tue, 21 Nov 2023 03:29:02 GMT) Full text and rfc822 format available.

Message #47 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: noah.v.peart <at> gmail.com, casouri <at> gmail.com, 67031 <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Tue, 21 Nov 2023 05:27:41 +0200
> Date: Tue, 21 Nov 2023 00:28:23 +0200
> Cc: Eli Zaretskii <eliz <at> gnu.org>, casouri <at> gmail.com, 67031 <at> debbugs.gnu.org
> From: Dmitry Gutov <dmitry <at> gutov.dev>
> 
> On 20/11/2023 20:13, Noah Peart wrote:
> > Sorry, ignore the previous patch.  A couple additional rules were needed 
> > to handle
> > "while" and "else".
> 
> Looking good.
> 
> Eli, should this go to emacs-29?

Yes.  But we should wait for Noah's legal paperwork to be completed,
before we install.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Tue, 21 Nov 2023 04:43:02 GMT) Full text and rfc822 format available.

Message #50 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Noah Peart <noah.v.peart <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, casouri <at> gmail.com, 67031 <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Mon, 20 Nov 2023 20:41:49 -0800
[Message part 1 (text/plain, inline)]
I believe my copyright assignment is on file - Eli, I think you checked for
me
last month.

On Mon, Nov 20, 2023 at 7:27 PM Eli Zaretskii <eliz <at> gnu.org> wrote:

> > Date: Tue, 21 Nov 2023 00:28:23 +0200
> > Cc: Eli Zaretskii <eliz <at> gnu.org>, casouri <at> gmail.com,
> 67031 <at> debbugs.gnu.org
> > From: Dmitry Gutov <dmitry <at> gutov.dev>
> >
> > On 20/11/2023 20:13, Noah Peart wrote:
> > > Sorry, ignore the previous patch.  A couple additional rules were
> needed
> > > to handle
> > > "while" and "else".
> >
> > Looking good.
> >
> > Eli, should this go to emacs-29?
>
> Yes.  But we should wait for Noah's legal paperwork to be completed,
> before we install.
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Tue, 21 Nov 2023 11:46:01 GMT) Full text and rfc822 format available.

Message #53 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Noah Peart <noah.v.peart <at> gmail.com>
Cc: dmitry <at> gutov.dev, casouri <at> gmail.com, 67031 <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Tue, 21 Nov 2023 13:44:32 +0200
> From: Noah Peart <noah.v.peart <at> gmail.com>
> Date: Mon, 20 Nov 2023 20:41:49 -0800
> Cc: Dmitry Gutov <dmitry <at> gutov.dev>, casouri <at> gmail.com, 67031 <at> debbugs.gnu.org
> 
> I believe my copyright assignment is on file - Eli, I think you checked for me 
> last month.

Yes, sorry, my bad.  I was coffee-challenged and therefore confused.

So we can install this right away.




Reply sent to Dmitry Gutov <dmitry <at> gutov.dev>:
You have taken responsibility. (Tue, 21 Nov 2023 14:10:02 GMT) Full text and rfc822 format available.

Notification sent to nvp <noah.v.peart <at> gmail.com>:
bug acknowledged by developer. (Tue, 21 Nov 2023 14:10:03 GMT) Full text and rfc822 format available.

Message #58 received at 67031-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Eli Zaretskii <eliz <at> gnu.org>, Noah Peart <noah.v.peart <at> gmail.com>
Cc: casouri <at> gmail.com, 67031-done <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Tue, 21 Nov 2023 16:09:34 +0200
Version: 29.2

On 21/11/2023 13:44, Eli Zaretskii wrote:
>> From: Noah Peart<noah.v.peart <at> gmail.com>
>> Date: Mon, 20 Nov 2023 20:41:49 -0800
>> Cc: Dmitry Gutov<dmitry <at> gutov.dev>,casouri <at> gmail.com,67031 <at> debbugs.gnu.org
>>
>> I believe my copyright assignment is on file - Eli, I think you checked for me
>> last month.
> Yes, sorry, my bad.  I was coffee-challenged and therefore confused.
> 
> So we can install this right away.

Thanks, installed.

I've also backported the test setup from master, so it'll be easier to 
add changes like this to Emacs 29.2 in the future.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Tue, 21 Nov 2023 14:25:01 GMT) Full text and rfc822 format available.

Message #61 received at 67031-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dmitry Gutov <dmitry <at> gutov.dev>
Cc: noah.v.peart <at> gmail.com, casouri <at> gmail.com, 67031-done <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Tue, 21 Nov 2023 16:23:30 +0200
> Date: Tue, 21 Nov 2023 16:09:34 +0200
> Cc: casouri <at> gmail.com, 67031-done <at> debbugs.gnu.org
> From: Dmitry Gutov <dmitry <at> gutov.dev>
> 
> Version: 29.2
> 
> On 21/11/2023 13:44, Eli Zaretskii wrote:
> >> From: Noah Peart<noah.v.peart <at> gmail.com>
> >> Date: Mon, 20 Nov 2023 20:41:49 -0800
> >> Cc: Dmitry Gutov<dmitry <at> gutov.dev>,casouri <at> gmail.com,67031 <at> debbugs.gnu.org
> >>
> >> I believe my copyright assignment is on file - Eli, I think you checked for me
> >> last month.
> > Yes, sorry, my bad.  I was coffee-challenged and therefore confused.
> > 
> > So we can install this right away.
> 
> Thanks, installed.
> 
> I've also backported the test setup from master, so it'll be easier to 
> add changes like this to Emacs 29.2 in the future.

Thanks, but it looks like you forgot to push...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Tue, 21 Nov 2023 14:28:01 GMT) Full text and rfc822 format available.

Message #64 received at 67031-done <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dmitry <at> gutov.dev>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: noah.v.peart <at> gmail.com, casouri <at> gmail.com, 67031-done <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Tue, 21 Nov 2023 16:27:26 +0200
On 21/11/2023 16:23, Eli Zaretskii wrote:
>> Date: Tue, 21 Nov 2023 16:09:34 +0200
>> Cc:casouri <at> gmail.com,67031-done <at> debbugs.gnu.org
>> From: Dmitry Gutov<dmitry <at> gutov.dev>
>>
>> Version: 29.2
>>
>> On 21/11/2023 13:44, Eli Zaretskii wrote:
>>>> From: Noah Peart<noah.v.peart <at> gmail.com>
>>>> Date: Mon, 20 Nov 2023 20:41:49 -0800
>>>> Cc: Dmitry Gutov<dmitry <at> gutov.dev>,casouri <at> gmail.com,67031 <at> debbugs.gnu.org
>>>>
>>>> I believe my copyright assignment is on file - Eli, I think you checked for me
>>>> last month.
>>> Yes, sorry, my bad.  I was coffee-challenged and therefore confused.
>>>
>>> So we can install this right away.
>> Thanks, installed.
>>
>> I've also backported the test setup from master, so it'll be easier to
>> add changes like this to Emacs 29.2 in the future.
> Thanks, but it looks like you forgot to push...

Ah thanks. The first try failed due to conflict.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Sat, 25 Nov 2023 03:47:02 GMT) Full text and rfc822 format available.

Message #67 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Noah Peart <noah.v.peart <at> gmail.com>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, Eli Zaretskii <eliz <at> gnu.org>,
 67031 <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Fri, 24 Nov 2023 19:46:19 -0800

> On Nov 20, 2023, at 10:13 AM, Noah Peart <noah.v.peart <at> gmail.com> wrote:
> 
> Sorry, ignore the previous patch.  A couple additional rules were needed to handle 
> "while" and "else".
> 
> On Mon, Nov 20, 2023 at 10:07 AM Noah Peart <noah.v.peart <at> gmail.com> wrote:
> Here is an updated patch with the added "else_clause" and indentation test for 
> statements without braces.
> 
> On Mon, Nov 20, 2023 at 4:55 AM Noah Peart <noah.v.peart <at> gmail.com> wrote:
> Yea, I'm using the same.  But, would it be useful to have a way to set that when 
> running tests without needing to temporarily add set `treesit-extra-load-path` in 
> the test file?
> 
> On Sun, Nov 19, 2023 at 5:38 AM Dmitry Gutov <dmitry <at> gutov.dev> wrote:
> On 19/11/2023 08:08, Eli Zaretskii wrote:
> >> Date: Sun, 19 Nov 2023 03:24:49 +0200
> >> Cc:casouri <at> gmail.com,67031 <at> debbugs.gnu.org
> >> From: Dmitry Gutov<dmitry <at> gutov.dev>
> >>
> >> On 19/11/2023 02:12, Noah Peart wrote:
> >>> Yea, I can do that.
> >>>
> >>> Is there a recipe for running the tests with a tree-sitter library path?
> >> You mean with the default tree-sitter librayr path overridden? I'm not sure.
> > Why would an ERT test need that?  We are supposed to test Emacs with
> > the otherwise installed system features.  As tree-sitter grammars are
> > not part of Emacs, there should be no need to tell Emacs to use a
> > grammar library other than the one installed on the system.  Right?
> 
> We have a way to override that with the variable 
> treesit-extra-load-path, so it follows that some users will take 
> advantage of it to add extra directories.
> 
> I'm using ~/.emacs.d/tree-sitter/ myself.
> <typescript-ts-mode-indentation.patch>

That’s great! Is there anything else blocking us from applying this patch? Does Noah have the copyright assignment?

Yuan





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#67031; Package emacs. (Sat, 25 Nov 2023 03:50:01 GMT) Full text and rfc822 format available.

Message #70 received at 67031 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Noah Peart <noah.v.peart <at> gmail.com>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, Eli Zaretskii <eliz <at> gnu.org>,
 67031 <at> debbugs.gnu.org
Subject: Re: bug#67031: [PATCH] Fix typescript-ts-mode indentation in
 unbracketed statements
Date: Fri, 24 Nov 2023 19:48:43 -0800
> On Nov 24, 2023, at 7:46 PM, Yuan Fu <casouri <at> gmail.com> wrote:
> 
> 
> 
>> On Nov 20, 2023, at 10:13 AM, Noah Peart <noah.v.peart <at> gmail.com> wrote:
>> 
>> Sorry, ignore the previous patch.  A couple additional rules were needed to handle 
>> "while" and "else".
>> 
>> On Mon, Nov 20, 2023 at 10:07 AM Noah Peart <noah.v.peart <at> gmail.com> wrote:
>> Here is an updated patch with the added "else_clause" and indentation test for 
>> statements without braces.
>> 
>> On Mon, Nov 20, 2023 at 4:55 AM Noah Peart <noah.v.peart <at> gmail.com> wrote:
>> Yea, I'm using the same.  But, would it be useful to have a way to set that when 
>> running tests without needing to temporarily add set `treesit-extra-load-path` in 
>> the test file?
>> 
>> On Sun, Nov 19, 2023 at 5:38 AM Dmitry Gutov <dmitry <at> gutov.dev> wrote:
>> On 19/11/2023 08:08, Eli Zaretskii wrote:
>>>> Date: Sun, 19 Nov 2023 03:24:49 +0200
>>>> Cc:casouri <at> gmail.com,67031 <at> debbugs.gnu.org
>>>> From: Dmitry Gutov<dmitry <at> gutov.dev>
>>>> 
>>>> On 19/11/2023 02:12, Noah Peart wrote:
>>>>> Yea, I can do that.
>>>>> 
>>>>> Is there a recipe for running the tests with a tree-sitter library path?
>>>> You mean with the default tree-sitter librayr path overridden? I'm not sure.
>>> Why would an ERT test need that?  We are supposed to test Emacs with
>>> the otherwise installed system features.  As tree-sitter grammars are
>>> not part of Emacs, there should be no need to tell Emacs to use a
>>> grammar library other than the one installed on the system.  Right?
>> 
>> We have a way to override that with the variable 
>> treesit-extra-load-path, so it follows that some users will take 
>> advantage of it to add extra directories.
>> 
>> I'm using ~/.emacs.d/tree-sitter/ myself.
>> <typescript-ts-mode-indentation.patch>
> 
> That’s great! Is there anything else blocking us from applying this patch? Does Noah have the copyright assignment?

Never mind, just saw the follow-up. My email client’s threading has been messed up and some messages ended up in different threads :-(

Yuan



bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 23 Dec 2023 12:24:08 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 139 days ago.

Previous Next


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