[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/csharp-mode 8ab3cc8 239/459: Dirty hack to force type-i
From: |
ELPA Syncer |
Subject: |
[elpa] externals/csharp-mode 8ab3cc8 239/459: Dirty hack to force type-initializer indentation. |
Date: |
Sun, 22 Aug 2021 13:59:35 -0400 (EDT) |
branch: externals/csharp-mode
commit 8ab3cc8d0143c878cab0f3424916cd9c0edc3217
Author: Jostein Kjønigsen <jostein@kjonigsen.net>
Commit: Jostein Kjønigsen <jostein@kjonigsen.net>
Dirty hack to force type-initializer indentation.
This potentially fixes
https://github.com/josteink/csharp-mode/issues/94.
---
csharp-mode.el | 15 +++++++++++----
test-files/indentation-tests.cs | 21 +++++++++++++++++++++
2 files changed, 32 insertions(+), 4 deletions(-)
diff --git a/csharp-mode.el b/csharp-mode.el
index ffce5f7..25a8aaa 100644
--- a/csharp-mode.el
+++ b/csharp-mode.el
@@ -299,6 +299,7 @@
;; - Fix fontification of using and namespace-statements with
;; underscores in them.
;; - Derive csharp-mode-map from prog-mode-map.
+;; - Fixes for indentation for many kinds of type-initializers.
;;
;;; Code:
@@ -2611,13 +2612,19 @@ are the string substitutions (see `format')."
(c-safe (c-forward-sexp -1))
(looking-at csharp-enum-decl-re))
- ;; no need to forward when looking here, because
enum
- ;; check already did it!
+ ;; type-initializers are not properly detected and
+ ;; indented unless we help out. (no need to forward
+ ;; when looking here, because enum-check already
did
+ ;; it!)
(looking-at
csharp-type-initializer-statement-re))))
(setq bracepos (c-down-list-forward (point)))
- (not (c-crosses-statement-barrier-p (point)
- (- bracepos 2))))
+ (or
+ (not (c-crosses-statement-barrier-p (point)
+ (- bracepos 2)))
+ ;; this little hack (combined with the regexp-check above)
+ ;; fixes indentation for all type-initializers.
+ (c-major-mode-is 'csharp-mode)))
(point)))))
;; this will pick up array/aggregate init lists, even if they are nested.
diff --git a/test-files/indentation-tests.cs b/test-files/indentation-tests.cs
index c0c4d8f..199f936 100644
--- a/test-files/indentation-tests.cs
+++ b/test-files/indentation-tests.cs
@@ -134,6 +134,27 @@ namespace Boo
May = "Yay"
};
+ // extra test-cases
+
+ new Foo{
+ a,
+ b,
+ c
+ };
+
+ new Foo {
+ a,
+ b,
+ c
+ };
+
+ new Foo
+ {
+ a,
+ b,
+ c
+ };
+
using (test)
{
System.Console.WriteLine("boo");
- [elpa] externals/csharp-mode 81cf94d 214/459: Update test-data., (continued)
- [elpa] externals/csharp-mode 81cf94d 214/459: Update test-data., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode bd42802 216/459: Indentation fix (#88), ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 0c4edfd 217/459: Hopefully fix this CI-snafu for now., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 6ccf2cf 219/459: Apply syntax propertize function silently, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 6c0a0d6 220/459: Bump version. Update changelog., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode b87332e 222/459: Update documentation for Emacs 25., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 4516a18 223/459: Fix indentation of generic type-initializers., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode ed7c30c 224/459: WIP: Fix checkdoc- and package-lint errors, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode bbd2888 232/459: Merge branch 'mattiasb-fix-warnings', ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode bc6a419 237/459: Update changelog., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 8ab3cc8 239/459: Dirty hack to force type-initializer indentation.,
ELPA Syncer <=
- [elpa] externals/csharp-mode d39d9ac 241/459: Revert "Make csharp-mode-map inherit from prog-mode-map", ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 0027f9c 246/459: Issue #112: Allow whitespace after the `#` in a directive., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode bd54e4d 250/459: Add csharp group definition, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 331b45d 251/459: Try fix/update CI-settings, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 85ae15d 252/459: Hacky formatting trick to make codedoc work with Omnisharp defaults, ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 461cd87 254/459: Fix compilation error on Emacs 26., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode ba7a81a 253/459: Advise c-inside-bracelist-p (#122), ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 5bfd3d2 257/459: Fix fontification of namespaces in using-statements., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode 561c359 258/459: Fix fontification in Emacs27., ELPA Syncer, 2021/08/22
- [elpa] externals/csharp-mode c66916e 259/459: Update version/meta-data., ELPA Syncer, 2021/08/22