From: Dmitry Gutov <dmitry@gutov.dev>
To: Noah Peart <noah.v.peart@gmail.com>, 67488@debbugs.gnu.org
Subject: bug#67488: [PATCH] Fix typescript-ts-mode indentation for switch statements
Date: Tue, 28 Nov 2023 02:39:02 +0200 [thread overview]
Message-ID: <3420a38f-6ae7-fd20-28d8-e4815c8fa3cc@gutov.dev> (raw)
In-Reply-To: <CAPVBTSc+yTwtk8zkfs3iwxC6GvKE3ABvJi9xzAPtNPuk4UMVKA@mail.gmail.com>
On 27/11/2023 19:07, Noah Peart wrote:
> Tags: patch
>
> * lisp/progmodes/typescript-ts-mode.el(typescript-ts-mode): Add indentation
> rule for switch case and default keywords.
>
> Bug: `typescript-ts-mode` is missing indentation rules for 'case' and
> 'default' keywords in switch statements.
>
> Recipe to reproduce:
> Copy the following code into a buffer:
>
> const foo = (x: string) => {
> switch (x) {
> case "a":
> console.log(x);
> return 1;
> case "b":
> return 2;
> case "c":
> default:
> return 0;
> }
> };
>
> And call the following function to configure typescript-ts-mode and
> indent the buffer
>
> (defun my-ts-indentation ()
> (interactive)
> (setq indent-tabs-mode nil)
> (setq typescript-ts-mode-indent-offset 2)
> (typescript-ts-mode)
> (indent-region (point-min) (point-max)))
>
> The indentation for the 'case' and 'default' branches within the switch
> statement should still be unchanged due to missing indent rules.
> Bug applies to emacs 29 as well.
Thanks! Can repro. The fix looks good as well.
next prev parent reply other threads:[~2023-11-28 0:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-27 17:07 bug#67488: [PATCH] Fix typescript-ts-mode indentation for switch statements Noah Peart
2023-11-28 0:39 ` Dmitry Gutov [this message]
2023-11-28 5:53 ` Yuan Fu
2023-11-29 14:35 ` 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=3420a38f-6ae7-fd20-28d8-e4815c8fa3cc@gutov.dev \
--to=dmitry@gutov.dev \
--cc=67488@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).