emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/swift-mode 0c734dd 112/496: Indent multiline hash and arra


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode 0c734dd 112/496: Indent multiline hash and array syntax same way as Xcode does
Date: Sun, 29 Aug 2021 11:33:18 -0400 (EDT)

branch: elpa/swift-mode
commit 0c734dd99901613c653684e34bf529d8574591fd
Author: ap4y <lod@pisem.net>
Commit: ap4y <lod@pisem.net>

    Indent multiline hash and array syntax same way as Xcode does
---
 swift-mode.el             |  4 ++++
 test/indentation-tests.el | 23 +++++++++++++++++------
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/swift-mode.el b/swift-mode.el
index ac810cd..d094cbf 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -239,6 +239,10 @@
          (if (smie-rule-parent-p "{")
              swift-indent-offset
            (smie-rule-parent))))
+
+    (`(:before . "(")
+     (if (smie-rule-next-p "[") (smie-rule-parent)))
+    (`(:before . "[") (smie-rule-parent))
     ))
 
 ;;; Font lock
diff --git a/test/indentation-tests.el b/test/indentation-tests.el
index 4c9152a..3d35adf 100644
--- a/test/indentation-tests.el
+++ b/test/indentation-tests.el
@@ -694,11 +694,11 @@ let foo = [foo: bar, bar: baz]
   "
 let foo = [
 |bar: baz
-    ]
+]
 " "
 let foo = [
-        |bar: baz
-    ]
+    |bar: baz
+]
 ")
 
 (check-indentation indents-declaration/5
@@ -714,11 +714,11 @@ let foo = [foo, bar]
   "
 let foo = [
 |bar
-    ]
+]
 " "
 let foo = [
-        |bar
-    ]
+    |bar
+]
 ")
 
 (check-indentation indents-declaration/7
@@ -730,6 +730,17 @@ var result = Dictionary<String, V>()
 |foo
 ")
 
+(check-indentation indents-multiline-expressions/1
+"
+Foo.bar([
+|bar: baz
+])
+" "
+Foo.bar([
+    |bar: baz
+])
+")
+
 (check-indentation indents-type-annotations/1
                    "
 typealias Foo = Bar<Foo.Baz, Foo>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]