From: Dmitry Gutov <dmitry@gutov.dev>
To: Noah Peart <noah.v.peart@gmail.com>, 67758-done@debbugs.gnu.org
Subject: bug#67758: [PATCH] Add indentation rules for bracketless statements in js-ts-mode
Date: Tue, 12 Dec 2023 03:14:59 +0200 [thread overview]
Message-ID: <a7eed39d-3424-dc74-e648-a0faaaeb42a6@gutov.dev> (raw)
In-Reply-To: <CAPVBTSfg-7uC12DJhGCTKvALN-sumUFB-jimoZFSg502yq_U8Q@mail.gmail.com>
Version: 29.2
On 11/12/2023 01:33, Noah Peart wrote:
> Tags: patch
>
>
> * Bug: `js-ts-mode` is missing indentation rules for bracketless
> statements.
>
> These missing rules are the same as those that were previously missing
> from typescript-ts-mode (bug#67031).
>
> Recipe to reproduce:
>
> Using the following function to configure js-ts-mode and indent the
> buffer:
>
> (defun try-indent ()
> (interactive)
> (setq-local indent-tabs-mode nil)
> (setq-local js-indent-level 2)
> (js-ts-mode)
> (indent-region (point-min) (point-max)))
>
> Add the following example to a buffer and call `try-indent`.
>
> function bracketless_statements(x) {
> if (x == 0)
> console.log("if_statement");
> else if (x == 1)
> console.log("if_statement");
> else
> console.log("else_clause");
> for (let i = 0; i < 1; i++)
> console.log("for_statement");
> for (let _ of [true])
> console.log("for_in_statement");
> while (x-- > 0)
> console.log("while_statement");
> do
> console.log("do_statement");
> while (false)
> };
>
> Afterwards, you should see none of the statement bodies were indented.
Thanks! Installed.
prev parent reply other threads:[~2023-12-12 1:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-10 23:33 bug#67758: [PATCH] Add indentation rules for bracketless statements in js-ts-mode Noah Peart
2023-12-12 1:14 ` Dmitry Gutov [this message]
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=a7eed39d-3424-dc74-e648-a0faaaeb42a6@gutov.dev \
--to=dmitry@gutov.dev \
--cc=67758-done@debbugs.gnu.org \
--cc=noah.v.peart@gmail.com \
/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).