From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Yuan Fu Newsgroups: gmane.emacs.bugs Subject: bug#61626: 29.0.60; The indentation of switch case is broken on typescript-ts-mode and tsx-ts-mode Date: Fri, 24 Feb 2023 21:00:45 -0800 Message-ID: References: Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3731.400.51.1.1\)) Content-Type: multipart/mixed; boundary="Apple-Mail=_0A546D06-A0FF-45DC-A221-EC73732A09FD" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29516"; mail-complaints-to="usenet@ciao.gmane.io" Cc: theo@thornhill.no, 61626@debbugs.gnu.org To: Eason Huang Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 25 06:02: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 1pVmhJ-0007Q6-Lu for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 25 Feb 2023 06:02:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVmh9-0003NY-T2; Sat, 25 Feb 2023 00:02:03 -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 1pVmh8-0003NJ-Ea for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 00:02:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pVmh8-0007xz-41 for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 00:02:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pVmh7-0007GD-Lz for bug-gnu-emacs@gnu.org; Sat, 25 Feb 2023 00:02:01 -0500 X-Loop: help-debbugs@gnu.org In-Reply-To: Resent-From: Yuan Fu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 25 Feb 2023 05:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61626 X-GNU-PR-Package: emacs Original-Received: via spool by 61626-submit@debbugs.gnu.org id=B61626.167730126627847 (code B ref 61626); Sat, 25 Feb 2023 05:02:01 +0000 Original-Received: (at 61626) by debbugs.gnu.org; 25 Feb 2023 05:01:06 +0000 Original-Received: from localhost ([127.0.0.1]:38794 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVmgD-0007F4-OK for submit@debbugs.gnu.org; Sat, 25 Feb 2023 00:01:06 -0500 Original-Received: from mail-pl1-f171.google.com ([209.85.214.171]:33555) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pVmgB-0007EM-9I for 61626@debbugs.gnu.org; Sat, 25 Feb 2023 00:01:03 -0500 Original-Received: by mail-pl1-f171.google.com with SMTP id p6so717599plf.0 for <61626@debbugs.gnu.org>; Fri, 24 Feb 2023 21:01:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:cc:date:message-id:subject:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=rRX+jzNS3aWzxaBdRj0RYawbmeJDkR39sG0hrXi4yvg=; b=JjCHB77xocCZtz3W67CZ+eK44mfDt53yOIAgxls/rhIwvr1LEd8wcfEjuk17TtGKz/ aAPoPa9uSQmzs7LjfBtM88+kHvNKVpjPxYqqmWyYPZIIbVoQlmGJjgG3t8VEEA2Asq8S Us6GzYqMqD132Qi0vJdbWfvrG5q8sykST2PUkoKW46VlG3p+rTteic1UYC4zxWeI+Bxc ia9Nwlh/NZ8b9JG/+OD3pVgNIZuaXY81qRGhMgHor9VJ7+r0xaEWQJlf8zDp6bT6b7L/ PA6ROQ4NIQgHo+f2dgMdwirf913RIFtCwIcwFrzFLfLBmfHW41vt3saupZd5zCJxg3Xd MZFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:cc:date:message-id:subject:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=rRX+jzNS3aWzxaBdRj0RYawbmeJDkR39sG0hrXi4yvg=; b=eFNCZ5XtDgHbSXmqCqk6qlIeZaAz/TAuHGcY6WzAs+Gyw090Zeb7bhl5XorludBJtJ 3uD3qeAVGLmLUfxTNmmEGzOdZKu5HKcHPC5CZl/JHtHLmJr++15EZbF0tNu6LiElbpBj vXZEhdUP7HKUEChTHTyuNDXGkSpFrvGbkwnk0RD2x9gTzsqHyJIKXw/2jR6KDusa4+6Z RMTefG8qQKuEEgOl37+75cACTwRWs8m4agEuny+u9F/8NypDTccU1ndVkS5iY6wc1G0A iduOeVNggGf5ASDD6gY9uEZOfhbkY4H0zdQvrGZBAeODTOtkwojVQKumzgHJyVjYd907 IMCw== X-Gm-Message-State: AO0yUKXLMlsM60PZEDdNyAsi3GYw7dG1B1p7sBoV+oaDCe6CguhPHbvG gqUV3J3sTP9MlfIkel156+0= X-Google-Smtp-Source: AK7set9HpKIqMhJ5f2bUEcL0IMFVRPQOJ596oe8G2kWyV9dZNCmNMZUsN6M3sxdF8eYKtdQlKQ36Rw== X-Received: by 2002:a17:902:f547:b0:19a:81c1:e743 with SMTP id h7-20020a170902f54700b0019a81c1e743mr20107514plf.2.1677301257454; Fri, 24 Feb 2023 21:00:57 -0800 (PST) Original-Received: from smtpclient.apple (cpe-172-117-161-177.socal.res.rr.com. [172.117.161.177]) by smtp.gmail.com with ESMTPSA id bd12-20020a170902830c00b0019afb7a02a1sm308372plb.218.2023.02.24.21.00.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Feb 2023 21:00:56 -0800 (PST) X-Mailer: Apple Mail (2.3731.400.51.1.1) 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:256680 Archived-At: --Apple-Mail=_0A546D06-A0FF-45DC-A221-EC73732A09FD Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii Eason Huang writes: > Hello Theodor and Emacs dev team, > > Recently I found that the indentation is broken in typescript-ts-mode > and tsx-ts-mode. When I press RET (M-x newline) after the ':' in the > case clause, it will always indent to the the same position of = previouse line. > > For example: > In typescript-ts-mode and tsx-ts-mode will get this result as below: > > ``` > let day: number =3D 1; > > switch (day) { > case 0: > console.log("It is a Sunday."); > break; > case 1: > console.log("It is a Monday."); > break; > default: > console.log("No such day exists!"); > break; > } > ``` > expected: > > ``` > let day: number =3D 1; > > switch (day) { > case 0: > console.log("It is a Sunday."); > break; > case 1: > console.log("It is a Monday."); > break; > default: > console.log("No such day exists!"); > break; > } > ``` > > steps to reprodue: > > 1. start emacs with `emacs -Q` > 2. C-x C-f ~/test.tsx to open a test.tsx > 3. M-x typescript-ts-mode > 4. input the exmaple code mentioned above > 5. you will see the result. The following patch should fix this, Theo, WDYT? Yuan --Apple-Mail=_0A546D06-A0FF-45DC-A221-EC73732A09FD Content-Disposition: attachment; filename=switch-case.patch Content-Type: application/octet-stream; x-unix-mode=0644; name="switch-case.patch" Content-Transfer-Encoding: quoted-printable =46rom=206d42b7e63b39a18c027ad1115033704f4084e0b9=20Mon=20Sep=2017=20= 00:00:00=202001=0AFrom:=20Yuan=20Fu=20=0ADate:=20Fri,=20= 24=20Feb=202023=2020:59:04=20-0800=0ASubject:=20[PATCH]=20Fix=20= switch-case=20indentation=20in=20typescript-ts-mode=20(bug#61626)=0A=0A*=20= lisp/progmodes/typescript-ts-mode.el:=0A= (typescript-ts-mode--indent-rules):=20Add=20indent=20rule=20for=20case=20= and=0Adefault.=0A---=0A=20lisp/progmodes/typescript-ts-mode.el=20|=206=20= ++++++=0A=201=20file=20changed,=206=20insertions(+)=0A=0Adiff=20--git=20= a/lisp/progmodes/typescript-ts-mode.el=20= b/lisp/progmodes/typescript-ts-mode.el=0Aindex=20= 5b49b8f50a8..1ce76cdf517=20100644=0A---=20= a/lisp/progmodes/typescript-ts-mode.el=0A+++=20= b/lisp/progmodes/typescript-ts-mode.el=0A@@=20-81,8=20+81,14=20@@=20= typescript-ts-mode--indent-rules=0A=20=20=20=20=20=20((parent-is=20= "member_expression")=20parent-bol=20typescript-ts-mode-indent-offset)=0A=20= =20=20=20=20=20((parent-is=20"named_imports")=20parent-bol=20= typescript-ts-mode-indent-offset)=0A=20=20=20=20=20=20((parent-is=20= "statement_block")=20parent-bol=20typescript-ts-mode-indent-offset)=0A+=20= =20=20=20=20;;=20Children=20under=20"case:"=0A=20=20=20=20=20=20= ((parent-is=20"switch_case")=20parent-bol=20= typescript-ts-mode-indent-offset)=0A+=20=20=20=20=20;;=20"case:"=0A+=20=20= =20=20=20((node-is=20"switch_case")=20parent-bol=200)=0A+=20=20=20=20=20= ;;=20Children=20under=20"default:"=0A=20=20=20=20=20=20((parent-is=20= "switch_default")=20parent-bol=20typescript-ts-mode-indent-offset)=0A+=20= =20=20=20=20;;=20"default:"=0A+=20=20=20=20=20((node-is=20= "switch_default")=20parent-bol=200)=0A=20=20=20=20=20=20((parent-is=20= "type_arguments")=20parent-bol=20typescript-ts-mode-indent-offset)=0A=20=20= =20=20=20=20((parent-is=20"variable_declarator")=20parent-bol=20= typescript-ts-mode-indent-offset)=0A=20=20=20=20=20=20((parent-is=20= "arguments")=20parent-bol=20typescript-ts-mode-indent-offset)=0A--=20=0A= 2.33.1=0A=0A= --Apple-Mail=_0A546D06-A0FF-45DC-A221-EC73732A09FD Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii --Apple-Mail=_0A546D06-A0FF-45DC-A221-EC73732A09FD--