From: Noah Peart <noah.v.peart@gmail.com>
To: Dmitry Gutov <dmitry@gutov.dev>
Cc: Yuan Fu <casouri@gmail.com>, 68054@debbugs.gnu.org
Subject: bug#68054: [PATCH] Add tree-sitter indent rule for lexical decls in js/typescript
Date: Sun, 31 Dec 2023 00:35:39 -0500 [thread overview]
Message-ID: <CAPVBTScKwa-wsDpsWkcxO8z6UH3B2DZwRDCFWWph1q_2f6CtTA@mail.gmail.com> (raw)
In-Reply-To: <5fd5b131-962a-489d-a674-0e199cdfff25@gutov.dev>
[-- Attachment #1: Type: text/plain, Size: 1698 bytes --]
Yea, I agree that would be better - would you align on start the variable
names, or '=' like
`c-lineup-assignments`?
On Sat, Dec 30, 2023 at 7:31 PM Dmitry Gutov <dmitry@gutov.dev> wrote:
> On 30/12/2023 22:31, Yuan Fu wrote:
> >
> >> On Dec 29, 2023, at 8:24 PM, Yuan Fu<casouri@gmail.com> wrote:
> >>
> >>
> >>
> >>> On Dec 26, 2023, at 10:21 PM, Noah Peart<noah.v.peart@gmail.com>
> wrote:
> >>>
> >>> 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.
> > It seems that js-mode indents bar to align with foo, rather than
> indenting one level. I feel that we should do the same, WDYT?
>
> Yes, please. This also makes a difference when the variables are
> declared with 'const' instead of 'let'.
>
> We should also support 'var' declarations: the parent node type to match
> against is "variable_declaration".
>
[-- Attachment #2: Type: text/html, Size: 2539 bytes --]
next prev parent reply other threads:[~2023-12-31 5:35 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-27 6:21 bug#68054: [PATCH] Add tree-sitter indent rule for lexical decls in js/typescript Noah Peart
2023-12-30 4:24 ` Yuan Fu
2023-12-30 20:31 ` Yuan Fu
2023-12-31 0:31 ` Dmitry Gutov
2023-12-31 5:35 ` Noah Peart [this message]
2023-12-31 13:41 ` Dmitry Gutov
2024-01-01 4:56 ` Yuan Fu
2024-04-17 20:21 ` Noah Peart
2024-04-23 5:07 ` Yuan Fu
2024-04-24 0:15 ` Dmitry Gutov
2024-04-24 2:36 ` Noah Peart
2024-04-24 23:15 ` Dmitry Gutov
2024-04-25 22:48 ` Noah Peart
2024-04-26 1:06 ` Dmitry Gutov
2024-05-02 13:26 ` Noah Peart
2024-05-02 13:38 ` Noah Peart
2024-05-18 8:29 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPVBTScKwa-wsDpsWkcxO8z6UH3B2DZwRDCFWWph1q_2f6CtTA@mail.gmail.com \
--to=noah.v.peart@gmail.com \
--cc=68054@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=dmitry@gutov.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).