branch: externals/csharp-mode commit f83e2e3722000203363e98b77beb59761fa18579 Author: Jostein Kjønigsen <jost...@kjonigsen.net> Commit: Jostein Kjønigsen <jost...@kjonigsen.net>
Fix indentation of generic type-initializers. Activate test-case in indentation test. This closes https://github.com/josteink/csharp-mode/issues/85 --- csharp-mode.el | 7 ++++++- test-files/indentation-tests.cs | 11 +++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/csharp-mode.el b/csharp-mode.el index 6683bd5..77eb5c6 100644 --- a/csharp-mode.el +++ b/csharp-mode.el @@ -481,8 +481,13 @@ to work properly with code that includes attributes. ;; before open curly in object initializer. new Foo* { } ((and (looking-back (concat "\\<new[ \t\n\f\v\r]+" + ;; typename "\\(?:[A-Za-z_][[:alnum:]]*\\.\\)*" - "[A-Za-z_][[:alnum:]]*[\ t\n\f\v\r]*") nil) + "[A-Za-z_][[:alnum:]]*" + ;; optional generic constraint + "\\(?:<\\(?:[[:alpha:]][[:alnum:]]*\\)\\(?:[, ]+[[:alpha:]][[:alnum:]]*\\)*>\\)?" + ;; spacing + "[\ t\n\f\v\r]*") nil) (looking-at "[ \t\n\f\v\r]*{")) t) diff --git a/test-files/indentation-tests.cs b/test-files/indentation-tests.cs index d054655..9715840 100644 --- a/test-files/indentation-tests.cs +++ b/test-files/indentation-tests.cs @@ -53,12 +53,11 @@ namespace Boo { 2, "false" }, }; - // indents incorrectly! :( - // var map2 = new Dictionary<int,string> - // { - // { 1, "true" }, - // { 2, "false" }, - // }; + var map2 = new Dictionary<int,string> + { + { 1, "true" }, + { 2, "false" }, + }; using (test) {