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#60748: 30.0.50; [PATCH]: Fix indentation of object_expressions in csharp-ts-mode Date: Thu, 12 Jan 2023 09:15:44 +0100 Message-ID: <87eds0qibz.fsf@thornhill.no> Reply-To: Theodor Thornhill Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="23723"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= To: 60748@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jan 12 09:17:22 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 1pFsm0-0005t6-98 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 12 Jan 2023 09:17:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pFslm-0003RK-9b; Thu, 12 Jan 2023 03:17:06 -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 1pFslj-0003R9-Ns for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2023 03:17:03 -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 1pFslj-0001Qj-3m for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2023 03:17:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pFsli-0004te-Mg; Thu, 12 Jan 2023 03:17:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Theodor Thornhill Original-Sender: "Debbugs-submit" Resent-CC: jostein@secure.kjonigsen.net, bug-gnu-emacs@gnu.org Resent-Date: Thu, 12 Jan 2023 08:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 60748 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: Jostein =?UTF-8?Q?Kj=C3=B8nigsen?= Original-Received: via spool by submit@debbugs.gnu.org id=B.167351137018748 (code B ref -1); Thu, 12 Jan 2023 08:17:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 12 Jan 2023 08:16:10 +0000 Original-Received: from localhost ([127.0.0.1]:44519 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFskp-0004sE-00 for submit@debbugs.gnu.org; Thu, 12 Jan 2023 03:16:10 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:34344) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pFskj-0004rn-Ta for submit@debbugs.gnu.org; Thu, 12 Jan 2023 03:16:05 -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 1pFska-0003Hj-Ie for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2023 03:15:59 -0500 Original-Received: from out2.migadu.com ([2001:41d0:2:aacc::]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pFskY-0001Bm-2u for bug-gnu-emacs@gnu.org; Thu, 12 Jan 2023 03:15:52 -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=1673511345; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=AkU56LrBZtobjn/R7usT2UjY2/ijRpnKNrEg14VzImY=; b=dWRyHBp2Nplr1x7ZaZCYAO8aULDkUrJ3ai5BX4FlkW+sBFwzgflooU6HUYXqLUiqvSFKDo qbUbltgaWWX/vyyMrh3aG3AD7HkxKQRXSvbrVIAZfEVhR4Ar8/vvlJkirYofTIYtTxmx14 bSjnBeXpTanINnyCAq/Z+whGXAjN4T0XekvV/X9zKowdIFt0FSQnWTHKkVxmEAsUU1T4UY DNyraScrdF9+FGPv1nW1tl391mP9I1p5EwPMj9aDpw++AmWscYWXnotbxiVlt3OPiUTJpq WeWGwswwBNHr+qU9Rc5iKAOt1IYVP14lVIWRUS6gfi5zkY5FJpP0597Cc5zLYQ== X-Migadu-Flow: FLOW_OUT Received-SPF: pass client-ip=2001:41d0:2:aacc::; envelope-from=theo@thornhill.no; helo=out2.migadu.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:253182 Archived-At: --=-=-= Content-Type: text/plain Hi Jostein! What do you think of this patch? It fixes typing out this, taken from [0]: ``` namespace Foo { class Foo { void foo() { CatOwner owner = new CatOwner { Cats = new List { new X { Name = "Sylvester", Age=8 }, new Cat { Name = "Whiskers", Age=2 }, new Cat { Name = "Sasha", Age=14 } } }; var x = new { X = 5 }; Foo foo = new Foo { }; Cat cat = new Cat { Cats = new List { new X { Name = "Sten" }, new Y { Foo = "rst" } } }; Cat c = new Foo() { }; RudimentaryMultiValuedDictionary rudimentaryMultiValuedDictionary3 = new RudimentaryMultiValuedDictionary() { {"Group1", new string []{ "Bob", "John", "Mary" } }, { "Group2", new string[]{ "Eric", "Emily", "Debbie", "Jesse" } } }; } } } ``` Are there any regressions, or is this ok to you? Theo [0]: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-indentation-of-object_expressions-in-csharp-ts-m.patch >From 6efac3cb4c19c50dfb3d9ab5218e88325ff19441 Mon Sep 17 00:00:00 2001 From: Theodor Thornhill Date: Thu, 12 Jan 2023 09:06:45 +0100 Subject: [PATCH] Fix indentation of object_expressions in csharp-ts-mode * lisp/progmodes/csharp-mode.el (csharp-ts-mode--indent-rules): Make sure the opening brace is indented at parent-bol, and everything else is indented. --- lisp/progmodes/csharp-mode.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index 79afd7f91d..81ce41618e 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -640,6 +640,11 @@ compilation and evaluation time conflicts." ((parent-is "namespace_declaration") parent-bol 0) ((parent-is "class_declaration") parent-bol 0) ((parent-is "constructor_declaration") parent-bol 0) + ((parent-is "initializer_expression") parent-bol csharp-ts-mode-indent-offset) + ((match "{" "anonymous_object_creation_expression") parent-bol 0) + ((parent-is "anonymous_object_creation_expression") parent-bol csharp-ts-mode-indent-offset) + ((match "{" "object_creation_expression") parent-bol 0) + ((parent-is "object_creation_expression") parent-bol 0) ((parent-is "method_declaration") parent-bol 0) ((parent-is "enum_declaration") parent-bol 0) ((parent-is "operator_declaration") parent-bol 0) -- 2.34.1 --=-=-=--