From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Theodor Thornhill via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#61238: [PATCH] Fix go-ts-mode type switch and select case blocks indentation Date: Sat, 04 Feb 2023 09:24:08 +0100 Message-ID: <87v8khhm8n.fsf@thornhill.no> References: <87ilgj245n.fsf@mssdvd.com> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16791"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 61238@debbugs.gnu.org, eliz@gnu.org To: Davide Masserut Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Feb 04 09:25:38 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 1pODrd-00049e-Gs for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 04 Feb 2023 09:25:37 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pODrO-0000Xi-Lo; Sat, 04 Feb 2023 03:25:22 -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 1pODr5-0000OS-D2 for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 03:25:05 -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 1pODr4-0007lo-KF for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 03:25:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pODr4-0007cO-Ev for bug-gnu-emacs@gnu.org; Sat, 04 Feb 2023 03:25:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 Feb 2023 08:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61238 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 61238-submit@debbugs.gnu.org id=B61238.167549905729209 (code B ref 61238); Sat, 04 Feb 2023 08:25:02 +0000 Original-Received: (at 61238) by debbugs.gnu.org; 4 Feb 2023 08:24:17 +0000 Original-Received: from localhost ([127.0.0.1]:40612 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pODqL-0007b1-0T for submit@debbugs.gnu.org; Sat, 04 Feb 2023 03:24:17 -0500 Original-Received: from out-58.mta0.migadu.com ([91.218.175.58]:49852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pODqF-0007ap-1I for 61238@debbugs.gnu.org; Sat, 04 Feb 2023 03:24:16 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=thornhill.no; s=key1; t=1675499049; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=H0lRlRNAELGfrJDTDR9l8YUMIyWZqbEc3hDSkxfdjbc=; b=aVXt43j5l4uEZz4EfH7xQnJQZ6wCz8Iqdwnhsegj/6L/SyOWCvx1LFt26f0pXZRYBFhgSN IV37WW1CO5RtVEtshnYNM4x/x2Y0EPN4wtEG2Py0OYALVD3xRDQ1uVRuHv5aLKG8uFN4dC xj1f8tWNKgTjmSjQaT2DN1UX4nJvfpBenJurBkRWlrJah5WQVB2lI+jEmq9vgmzBbJ3K9s T14xSNQAENa7mmrHCNH6ZlOFNHrDlkLz/EjFgLrMBYf/MFsgmw7d7228hfBvRmdG3Lj7ht ZXnO270FwxUoNlxqsnB2gUP9l+msQNjZUUgzsNTWEV99Z/YE1MeUJGy+Xz9EQQ== In-Reply-To: <87ilgj245n.fsf@mssdvd.com> (Davide Masserut's message of "Thu, 02 Feb 2023 21:37:06 +0100") X-Migadu-Flow: FLOW_OUT 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:254755 Archived-At: Hey there, Davide, and thanks for the clear bug-report! This looks good to me, but before I install, Maybe you can also add a test for this, similar to the ones in c-ts-mode-tests.el? Also, just checking - is fsf assignment needed for this change? Maybe you've done it already, if so, forgive my ignorance :-) Theo > Tags: patch > > This patch add indentation for Go type switch and select case blocks. > > Current behavior > ``` > var x any > switch x.(type) { > case int: > println(x) > } > > var c chan int > select { > case x := <-c: > println(x) > } > ``` > > Correct behavior > ``` > var x any > switch x.(type) { > case int: > println(x) > } > > var c chan int > select { > case x := <-c: > println(x) > } > ``` > > >>>From b4d6ed0dcb2536d6345e38edd7fc3ae1661d99b7 Mon Sep 17 00:00:00 2001 > From: Davide Masserut > Date: Thu, 2 Feb 2023 21:00:02 +0100 > Subject: [PATCH] Fix go-ts-mode type switch and select case blocks indentation > > * lisp/progmodes/go-ts-mode.el (go-ts-mode--indent-rules): Add > indentation for type switch and select case blocks > --- > lisp/progmodes/go-ts-mode.el | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el > index 5f3e1ea3e68..0270b92445d 100644 > --- a/lisp/progmodes/go-ts-mode.el > +++ b/lisp/progmodes/go-ts-mode.el > @@ -72,6 +72,7 @@ go-ts-mode--indent-rules > ((node-is "labeled_statement") no-indent) > ((parent-is "argument_list") parent-bol go-ts-mode-indent-offset) > ((parent-is "block") parent-bol go-ts-mode-indent-offset) > + ((parent-is "communication_case") parent-bol go-ts-mode-indent-offset) > ((parent-is "const_declaration") parent-bol go-ts-mode-indent-offset) > ((parent-is "default_case") parent-bol go-ts-mode-indent-offset) > ((parent-is "expression_case") parent-bol go-ts-mode-indent-offset) > @@ -82,6 +83,7 @@ go-ts-mode--indent-rules > ((parent-is "labeled_statement") parent-bol go-ts-mode-indent-offset) > ((parent-is "literal_value") parent-bol go-ts-mode-indent-offset) > ((parent-is "parameter_list") parent-bol go-ts-mode-indent-offset) > + ((parent-is "type_case") parent-bol go-ts-mode-indent-offset) > ((parent-is "type_spec") parent-bol go-ts-mode-indent-offset) > ((parent-is "var_declaration") parent-bol go-ts-mode-indent-offset) > (no-node parent-bol 0)))