GNU bug report logs - #68054
[PATCH] Add tree-sitter indent rule for lexical decls in js/typescript

Previous Next

Package: emacs;

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

Date: Wed, 27 Dec 2023 06:22:01 UTC

Severity: wishlist

Tags: patch

Done: Stefan Kangas <stefankangas <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: Stefan Kangas <stefankangas <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#68054: closed ([PATCH] Add tree-sitter indent rule for
 lexical decls in js/typescript)
Date: Thu, 13 Feb 2025 07:06:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Wed, 12 Feb 2025 23:05:34 -0800
with message-id <CADwFkmkBjsxL3riDi5MeM+kdBw7As5bxK_4hTBATE72LoXoUDg <at> mail.gmail.com>
and subject line Re: bug#68054: [PATCH] Add tree-sitter indent rule for lexical decls in js/typescript
has caused the debbugs.gnu.org bug report #68054,
regarding [PATCH] Add tree-sitter indent rule for lexical decls in js/typescript
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
68054: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=68054
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Noah Peart <noah.v.peart <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Add tree-sitter indent rule for lexical decls in js/typescript
Date: Wed, 27 Dec 2023 01:21:05 -0500
[Message part 3 (text/plain, inline)]
Tags: patch

* Bug: `js-ts-mode` and `typescript-ts-mode` are missing indentation
rules for lexical declarations that span multiple lines.

Recipe to reproduce:

Using the following function to configure js-ts-mode and indent the
buffer:

    (defun try-indent ()
      (interactive)
      (js-ts-mode)
      (setq-local indent-tabs-mode nil)
      (setq-local js-indent-level 4)
      (indent-region (point-min) (point-max)))

Add the following example to a buffer and call `try-indent`.

    let foo = 1,
    bar = 2; // no indent rule matches this line

No indentation is applied to the second line.

This patch adds a simple indentation rules for `js-ts-mode` and
`typescript-ts-mode` to handle the multi-line lexical declarations.


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-12-26 built on nverno-XPS-8940
Repository revision: d376462c7183752bf44b9bd20bf5020fe7eaf75a
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 4 (text/html, inline)]
[js-ts-indent-decls.patch (text/x-patch, attachment)]
[Message part 6 (message/rfc822, inline)]
From: Stefan Kangas <stefankangas <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Dmitry Gutov <dmitry <at> gutov.dev>, casouri <at> gmail.com,
 68054-done <at> debbugs.gnu.org, noah.v.peart <at> gmail.com
Subject: Re: bug#68054: [PATCH] Add tree-sitter indent rule for lexical decls
 in js/typescript
Date: Wed, 12 Feb 2025 23:05:34 -0800
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Cc: Yuan Fu <casouri <at> gmail.com>, 68054 <at> debbugs.gnu.org
>> Date: Sun, 9 Jun 2024 05:48:57 +0300
>> From: Dmitry Gutov <dmitry <at> gutov.dev>
>>
>> On 02/05/2024 16:26, Noah Peart wrote:
>> > Ok, here is an updated patch for option 3.  The indentation looks like
>> > the examples
>> > you've provided - it's the same indentation as in js-mode for these cases.
>>
>> Thanks! Pushed to master.
>
> Please also close the bug if appropriate.

Now done.


This bug report was last modified 191 days ago.

Previous Next


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