From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#67488: [PATCH] Fix typescript-ts-mode indentation for switch statements Date: Tue, 28 Nov 2023 02:39:02 +0200 Message-ID: <3420a38f-6ae7-fd20-28d8-e4815c8fa3cc@gutov.dev> References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39441"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 To: Noah Peart , 67488@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Nov 28 01:40:14 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r7m97-0009xO-DL for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 28 Nov 2023 01:40:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r7m8r-0007KQ-7x; Mon, 27 Nov 2023 19:39:57 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r7m8q-0007KH-7T for bug-gnu-emacs@gnu.org; Mon, 27 Nov 2023 19:39:56 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r7m8p-00042x-U7 for bug-gnu-emacs@gnu.org; Mon, 27 Nov 2023 19:39:55 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r7m8w-0005g2-4F for bug-gnu-emacs@gnu.org; Mon, 27 Nov 2023 19:40:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 28 Nov 2023 00:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67488 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 67488-submit@debbugs.gnu.org id=B67488.170113196021763 (code B ref 67488); Tue, 28 Nov 2023 00:40:02 +0000 Original-Received: (at 67488) by debbugs.gnu.org; 28 Nov 2023 00:39:20 +0000 Original-Received: from localhost ([127.0.0.1]:45084 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7m8F-0005ex-L3 for submit@debbugs.gnu.org; Mon, 27 Nov 2023 19:39:19 -0500 Original-Received: from out1-smtp.messagingengine.com ([66.111.4.25]:44755) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r7m8C-0005ej-TP for 67488@debbugs.gnu.org; Mon, 27 Nov 2023 19:39:18 -0500 Original-Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 062715C026D; Mon, 27 Nov 2023 19:39:05 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 27 Nov 2023 19:39:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1701131945; x=1701218345; bh=bT3EmxMwvk2gcXVI+kuyEObuOdkaHPbo1jh uzLPMypM=; b=asVviZ/RTN+3r1M/qbple2OXATSNofkvrn99K8goss/VxwFiw8h RqTlFTKsrHLqB1DCR/4v1II3KtpJ7gMDEYwWU/yeXeeyaMDB0meEi95PQqsXNQU0 btCDj9UU6cmZ6I6FYfv0SB/jPaQfQL4iIrzavUpbPLUjfyfKIcYI8bpADcULSt7N gQpgIIp3RY/JO3lWz2YEnC2R/XLinGHs/CANHslhG4G4dNR0+wf+bDw1t5HvChwt kmZ1Y+ZPWGLTzz8k8mAhEgGY9JOz6zZD4FnXtN6EOqz4dwnVFMv9YFZH/48nsxl4 +q+62sCCPNrnmLho/ClgSnwH345a4zfzteQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1701131945; x= 1701218345; bh=bT3EmxMwvk2gcXVI+kuyEObuOdkaHPbo1jhuzLPMypM=; b=w Z1K1t/cjqNyOsgqHAFrp/aXaECPx/g6YHLlxJ3yp+QOhuP+qLx4eEctdWjRvjzST O1XXt4mRlCuyVjNlaNcAx5HgBUZtniWnyAy1X6MKVW2jU7Y5/HTWP5C++miIobL4 34AlSNrLbvCmqImrYHbzZmMCf5ZY+UjQ2PX9TAK6c2NYCKO9wRYU8h9shi+wUH22 wTEz7HUowLOsRMnxZgSRO2+Fo0pb7lhVb4oNcZd085waiqL9qbnmzSis1cAnOtF1 4yRTr2YCICKdD4ELme56ttTALSJWlWyYFw1IPCrcBKpvW7WET+liWE0o8UcXK0YT TWmKYkW3zi0L1qqpBWxbw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudeivddgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepkfffgggfuffvfhfhjggtgfesthekredttdefjeenucfhrhhomhepffhmihht rhihucfiuhhtohhvuceoughmihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtth gvrhhnpeefjeekvedvfeelfedufeevgeetvdevkeelvddtueetteefudefgfduieekffei leenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegumh hithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 27 Nov 2023 19:39:03 -0500 (EST) Content-Language: en-US In-Reply-To: X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:275154 Archived-At: 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.