Subject: bug#60748: 30.0.50; [PATCH]: Fix indentation of object_expressions in csharp-ts-mode

From: Theodor Thornhill <[email-masked]>
Date: Thu, 12 Jan 2023 09:15:44 +0100

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<Cat>
                {
                    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<Cat>
                {
                    new X
                    {
                        Name = "Sten"
                    },
                    new Y
                    { Foo = "rst" }
                }
            };

            Cat c = new Foo()
            {
                
            };

            RudimentaryMultiValuedDictionary<string, string> rudimentaryMultiValuedDictionary3
                = new RudimentaryMultiValuedDictionary<string, string>()
                {
                    {"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]: 

>From 6efac3cb4c19c50dfb3d9ab5218e88325ff19441 Mon Sep 17 00:00:00 2001
From: Theodor Thornhill <[email-masked]>
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